Back to Dashboard

Java Programming

Complete Subject Question Bank

Subject Overview
Deep dive into core Java concepts, including Object-Oriented Programming (OOP), variables, conditional statements, arrays, constructors, and packages.
Java Programming#1

Using Java we can develop ___________________.

A
Desktop Application
B
Web Application
C
Both the options
D
None of these options

This question has been retained as-is due to its unique context.

Java Programming#2

The main method in java should ___________.

A
take boolean[] as argument
B
be public static
C
return int
D
be private static

This question has been retained as-is due to its unique context.

Java Programming#3

The break statement cannot be present for _____________ construct.

A
do while
B
while
C
for
D
if

This question has been retained as-is due to its unique context.

Java Programming#4

A continue statement makes the execution jump to ______________.

A
the end of the loop
B
the first statement of the loop
C
the next iteration of the loop
D
the statement just after continue

This question has been retained as-is due to its unique context.

Java Programming#5

Identify the features of java.

A
Exception Handling
B
Multi threading
C
Direct Access to memory using pointers
D
Less security

This question has been retained as-is due to its unique context.

Java Programming#6

a for loop, if the number of statements are greater than one, which of the following needs to be inserted at the beginning and the end of the loop?

A
Arrows<>
B
Square bracket [ ]
C
French curly braces{ }
D
Parenthesis

This question has been retained as-is due to its unique context.

Java Programming#7

JRE comprises of ___________ and ___________.

A
JVM
B
tools
C
API
D
JDK

This question has been retained as-is due to its unique context.

Java Programming#8
Logic Block
1
What will be the output of the program? public class Sample { final static short a = 2; public static int b = 0; public static void main(String [] args) { for (int c=0; c < 4; c++) { switch (c) { case a: System.out.print("a "); default: System.out.print("default "); case a-1: System.out.print("a-1 "); break; case a-2: System.out.print("a-2 "); } } } }
A
a-2 a-1 a default a-1 default a-1
B
a-2 a-1 a default a-1
C
a-2 a-1 a default default
D
a default a-1

This question has been retained as-is due to its unique context.

Java Programming#9

The ________________ statement causes the program execution to stop and JVM to shut down.

A
System.exit
B
break
C
return
D
exit

This question has been retained as-is due to its unique context.

Java Programming#10

JVM is independent of OS

A
True
B
False

This question has been retained as-is due to its unique context.

Java Programming#11

To compile, debug and execute a program written in java, _______________ is required.

A
JRE
B
JIT
C
JDK
D
JVM

This question has been retained as-is due to its unique context.

Java Programming#12

State true or false. Java is a structured programming language.

A
Java is a structured programming languag
B
TRUE
C
FALSE

This question has been retained as-is due to its unique context.

Java Programming#13

Who is the father of Java?

A
James Gosling
B
Dennis Ritchie
C
Jim Gray
D
Donald Knuth

This question has been retained as-is due to its unique context.

Java Programming#14

What is Polymorphism?

A
ability to acquire the properties
B
blueprint for an object
C
ability to have many forms
D
hiding the properties

This question has been retained as-is due to its unique context.

Java Programming#15

How was Java initially named?

A
GreenTalk
B
Algol
C
The Oak
D
COBOL

This question has been retained as-is due to its unique context.

Java Programming#16

Java is _____________________________.

A
Platform dependent
B
Platform independent

This question has been retained as-is due to its unique context.

Java Programming#17
Logic Block
1
What is the output of this program? 1. class Crivitch { 2. public static void main(String [] args) { 3. int x = 10; 4. 5. do { } while (x++ < y); 6. System.out.println(x); 7. } 8. } Which statement, inserted at line 4, produces the output 12?
A
int y=11;
B
int y=12;
C
int y=13;
D
int y=10;

This question has been retained as-is due to its unique context.

Java Programming#18
Logic Block
1
What will be the output of the program? Given: 10. int x = 0; 11. int y = 10; 12. do { 13. y--; 14. ++x; 15. } while (x < 5); 16. System.out.print(x + "," + y); What is the result?
A
6,5
B
5,5
C
5,6
D
6,6 x is assigned 0 and y, 10 initially. During each iteration x is incremented by 1 and y is decremented by 1. The iteration stops when x equals 5. At this stage y also would have reached the value 5. Hence the output 5 5.

This question has been retained as-is due to its unique context.

Java Programming#19
Logic Block
1
What is the output of this program? class selection_statements { public static void main(String args[]) { int var1 = 5; int var2 = 6; if ((var2 = 1) == var1) System.out.print(var2); else System.out.print(++var2); } }
A
3
B
4
C
2
D
1 Observe the if construct. var 2 is assigned 1. 1 does not equal 5, hence else block will get execute

This question has been retained as-is due to its unique context.

Java Programming#20
Logic Block
1
Fill in the appropriate data type for the Java switch statement: switch (____) { case value1: ... case value2: ... default: System.out.println("Hello"); }
A
byte
B
float
C
boolean
D
double

This question has been retained as-is due to its unique context.

Key Topics to Study

Based on our question bank analysis, master these concepts to score high in Java Programming.

JavaConstructorStringArraySwitchPackageEclipseCompilation