Answers 2025-2026 Updated.
What is the extension name of a Java source code file?
Select one:
a. .obj
b. .exe
c. .class
d. .java
e. .javac. - Answer d
What is the range of data type byte in Java?
Select one:
a. -2147483648 to 2147483647
b. -32768 to 32767
c. None of the mentioned
d. -128 to 127 - Answer d
Which statement is true regarding an object?
Select one:
a. An object is a reference to an attribute
b. An object is what classes instantiated are from
c. An object is not an instance of a class.
d. An object is an instance of a class
e. An object is a variable - Answer d
Given a class named student, which of the following is a valid constructor declaration for the
class?
Select one:
a. static void student () { }
b. Student student { }
c. Student (Student s) { }
d. void Student () { }
e. private final student { } - Answer d
,class Point {
int x,y;
Point (int x, int y) {
this.x = x;
this.y = y;
}
public String toString() {
return "Point[" +x+ "," +y+ "]";
}
}
public class Main{
public static void main (String args[]) {
Point p = new Point (10,20);
System.out.println("p=" +p);}
}
What is the output of the following code?
Select one:
a. p = Point[11,20]
b. p = Point[10,21].
c. p = Point[20,20]
d. p = Point[10,20]
e. p = Point[20,10] - Answer d
Modulus operator, %, can be applied to which of these?
Select one:
a. None of the mentioned
b. Floating - point numbers
c. Integers
d. Both Integers and floating - point numbers. - Answer d
What is the numerical range of a char in Java?
Select one:
a. 0 to 65535
b. -128 to 127
c. 0 to 32767
, d. 0 to 256 - Answer a
What will be the result of attempting to compile and run the following code?
class MyClass
{
public static void main(String[] args)
{
boolean b = false;
int i = 1;
do
{
i++;
b = !b;
} while (b);
System.out.println(i);
}
}
Select one:
a. The code will compile without error and will print 3 when run.
b. The code will fail to compile, since b is an invalid conditional expression in thedo-while
statement
c. The code will fail to compile, since the assignment b = !b is not allowed
d. The code will compile without error and will print 1 when run
e. The code will compile without error and will print 2 when run - Answer a
Literal can be of which of these data types?
Select one:
a. float
b. boolean
c. integer
d. all of the mentioned - Answer d
Consider the following class definition:
public class MyClass
{