Search This Blog

Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Tuesday, March 24, 2026

String Array - Java

 Which of the following statements will you use to create an initialized array of 5 strings?

a) String str = [“hi”, ”Fiona”, ”Ruby”, ”Dixie”, “Petunia”];

b) String str[] = new String[5] {“hi”, ”Fiona”, ”Ruby”, ”Dixie”, “Petunia”};

c) String str[] = {“hi”, ”Fiona”, ”Ruby”, ”Dixie”, “Petunia”};

d) String str[5] = {“hi”, ”Fiona”, ”Ruby”, ”Dixie”, “Petunia”};


Created by Nancy K.A.N.

@ 22:01 24-Mar-2026

Wednesday, January 28, 2026

Java Programming - A revision - episode 1

 What are the main reasons that Java is not considered a pure Object-Oriented Programming language?

a) Java uses pointers 

b) Java uses primitive data types like int, float, double, and so on

c) Java uses a main method like the C programming language, which is not OOP

d) Java uses static variables and methods, which are outside the scope of objects


Created by Nancy

@13:34 28-Jan-2026

Tuesday, December 16, 2025

Java Datatypes - 3

 Which of the following are not a Java datatypes?

a) boolean

b) bool

c) long

d) void

e) long float


Created by Nancy K.A.N.

@13:19 16-Dec-2025

Monday, November 3, 2025

Java Math API - 3

What is the output of the following code?

1. public class MathDemo2 {

2.     public static void main(String[] args) {

3.         System.out.println(Math.max(29,Math.min(93,Math.min(54,Math.max(47,45)))));

4.     }

5. }

6.  


Created by Nancy K.A.N.
@23:31 03-Nov-2025

Wednesday, October 29, 2025

Java Intro

 What is WORA in Java?

a) Write Only, Read Access

b) Write Off, Read Access

c) Write Once, Read Anywhere

d) Write Once, Run Anywhere


Created By: Nancy K.A.N.

@11:47 29-Oct-2025

Saturday, October 25, 2025

PRNG - Java

 Which of the following methods is not found in the Pseudo Random Number Generator (PRNG) API?

a) NextInt()

b) NextLong()

c) random()

d) NextDouble()


Created by Nancy K.A.N.

@13:03 25-Oct-2025


Tuesday, October 14, 2025

Java Closeable Interface methods

 Which of the following is a method of a Closeable interface?

a) void close (ByteStream ob)

b) void close (CharacterStream ob)

c) void close (FileStream file)

d) int close()

e) void close()


Created by Nancy K.A.N.

@00:36 15-Oct-2025

Monday, October 6, 2025

String Literals - 1

 Where JVM stores the string literals?

a) Stack memory

b) Special area on the stack

c) String constant pool

d) none of the above


Created by Nancy K.A.N.

@13:32 06-Oct-2025

Monday, September 29, 2025

Java super and this methods

 What will be the result of using super() and this() in the same method?

a) It will compile and run successfully

b) It will compile successfully, but will give a runtime error

c) It will give a compile-time error

d) Successful compilation and running will depend on the order in which super() and this() are used


Created by Nancy K.A.N.

@00:23 30-09-2025

Saturday, September 27, 2025

Java IO - Externalizable

 An Externalizable interface extends Serializable. Which of the following methods does an Externalizable interface add?

a) WriteData

b) WriteObject

c) WriteExternal

d) ReadData

e) ReadObject

f) ReadExternal


Created by Nancy K.A.N.

@00:44 28-Sept-2025

Wednesday, September 24, 2025

Java IO - Serializable

 Which of the following is not a method of a Serializable interface?

a) write()

b) serialize()

c) convertToBytes()

d) none (It has no methods)


Created by Nancy K.A.N.

@12:17 24-Sept-2025

Monday, September 22, 2025

Java Exceptions - 2

 Which of the following is a superclass of all exceptions and Errors in Java?

a) Exception

b) RuntimeException

c) Throwable

d) Error


Created by Nancy K.A.N.

@14:04 22-Sept-2025

Thursday, September 18, 2025

Java String API - 3

 Which of the following methods of the Java String class is deprecated?

a) getBytes(String)

b) getBytes(int, int,byte[],int)

c) getBytes(int,int,char[],int)

d) getBytes(charset)


Created by Nancy K.A.N.

@11:44 18-09-2025

Monday, September 15, 2025

Java Garbage Collection

 One of the features of Java is auto-garbage collection. It frees the coder from keeping track of deallocating memory, though you can request garbage collection. 

Which of the following can request garbage collection?

a) Runtime.free()

b) Runtime.getRuntime().gc()

c) System.gc()

d) System.clear()


Created by Nancy K.A.N.

@12:46 15-09-2025

Tuesday, September 2, 2025

Java Math API - 1

 Which of the following is a superclass of java.lang.Math class?

a) System

b) Process

c) Integer

d) Object


Created by Nancy K.A.N.  

@14:52 02-Sept-2025

Tuesday, August 26, 2025

Data type conversion - Java

 An integer variable does not have a fractional component. When a floating point value is assigned to an integer ______________________ happens.

a) Shrinking

b) upcasting

c) nothing

d) truncation


Created by Nancy K.A.N.

@14:42 26-Aug-2025

Friday, August 22, 2025

Java Command Line Arguments

 A Java application can receive arguments from the command line. These arguments can later be processed according to the application requirements. The user can pass these arguments while invoking a Java application:

C:\> java MyApp hello 100 200 300 bye

hello, 100, 200, 300, bye, are the arguments passed to the application MyApp.

When Java launches the application, to which method are these arguments passed?

a) getEnv method

b) getProperties method

c) main method

d) clone method


Created by Nancy K.A.N.

@11:13 22-08-2025

Wednesday, August 20, 2025

Java Runtime

 Which of the following Java classes' objects is responsible for loading classes at runtime?

a) System

b) Runtime

c) ClassLoader

d) Class


Created by: Nancy K.A.N.

@19:41 20-Aug-2025

Wednesday, July 2, 2025

Java Variables - 2

 Which of the following are invalid variable names in Java?

a) !

b) $

c) _$

d) _


Created by Nancy K.A.N.

@23:09 02-Jul-2025

Follow on YouTube

https://kannancy.blogspot.com/

Tuesday, July 1, 2025

Java String API - 1

 Which of the following methods is used to convert a Java String to an array of characters?

a) split()

b) getChars()

c) getBytes()

d) toCharArray()


Created by Nancy K.A.N.

@23:05 01-Jul-2025

Follow on YouTube

https://kannancy.blogspot.com/