Font size
WorksheetsJava Gamified Quiz
Total questions: 69
Worksheet time: 43mins
Polymorphism related to :
PPO
Class
OPP
OOP
The process by which objects of one class acquire the properties of objects of another class is known as
Polymorphism
Inheritance
Data Hiding
Association
Which of the these is the functionality of ‘Encapsulation’?
Binds together code and data
Using single interface for general class of actions
Reduce Complexity
All of the mentioned
How do you create a variable with the numeric value 5?
float x = 5;
x = 5;
int x = 5;
num x = 5
Which data type is used to create a variable that should store text?
myString
String
Txt
string
How do you insert COMMENTS in Java code?
# This is a comment
/* This is a comment
// This is a comment
Java is short for "JavaScript".
true
false
How do you create a variable with the floating number 2.8?
byte x = 2.8f
x = 2.8f;
float x = 2.8f;
int x = 2.8f;
The value of a string variable can be surrounded by single quotes.
true
false
How do you write a Single Liner Comment in Java?
(a)
Which operator is used to add together two values?
(a)
Which part of this for-statement tells how a variable or initial expression is changed or updated with every loop.
(a)
What is the logical operator NOT?
(a)
What Java Package contains the class - Scanner.
(a)
Which operator can be used to compare two values?
><
=
==
<>
Which keyword is used to return a value inside a method?
return
void
break
get
1. Which of this method is given parameter via command line arguments?
a) main()
b) recursive() method
c) Any method
d) System defined methods
What are the Type Conversions available in Java language?
A) Narrowing Type Conversion
B) Widening Type Conversion
A and B
D) None of the above
Which type of loop is best known for its boolean condition that controls entry to the loop?
A. do-while loop
B. for (traditional)
C. for-each
D. while
What will be the Output of the below code:
public class Demo{
public static void main(String[] arr){
}
public static void main(String arr){
}
}
a) Nothing
b) Error
C) Finite
d) Hii
char is 2 byte in storage?
True
False
What data type would you use for storing the number of students in a class?
boolean
String
double
int
What is the output of the following code snippet?
int i = 0; for(i = 0 ; i < 5; i++)
{ }
System.out.println(i);
A. 5
B. 0
C. 4
D. Compilation Error
Find the output for the following.
public class IncDec
{
public static void main(String s[])
{
int a = 1;
int b = 2;
int c;
int d;
c = ++b;
d = a++;
c++;
System.out.println("a = " + a);
System.out.print("b = " + b);
System.out.println("c = " + c);
System.out.print("d = " + d);
}
}
a = 2 b = 3 c = 4 d = 1
a = 2 b = 3 c = 4 d = 1
Program does not compile.
a = 1 b = 2 c = 4 d = 2
Is String a primitive data type?
Yes
No
Both
String txt = "Hello World";
System.out.println(txt.toUpperCase());
Choose the correct output.
"HELLO WORLD"
HELLO WORLD
Hello world
Hello World
What is the return type of equalsIgnorecase() method?
int
String
char
boolean
int a = 7;
int b = 2 + a;
b = 9
b = 2
b = 7
b = 5
int a = 5;
a++;
What is a now?
4
7
5
6
int a = 5;
a--;
What is a now?
4
3
5
6
int x = 4;
x *= 10;
Which is true?
x is now 40
x is now 10
x is still 4
x is now 14
A while loop carries on as long as...
The condition in the brackets is true
The condition in the brackets is false
i < 10
the for loop has not ended
A while loop has the following format:
while (condition)
{
...
}
while
{
...
}
continue while (condition)
{
...
}
while [condition]
[
...;
]
OUTPUT?
int i = 1;
while (i < 5) {
System.out.println("Hello");
i++;
}
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
Hello
How many times does the loop print a *
40
20
24
30
Infinite Loop
If a loop condition is never satisfied then the loop does not execute.
How many times does the following method print a *?
9
6
7
10
2
5
7
9
13
20
JAVA : I want to change this operation into division. What symbol should I choose?
/
÷
∥
*
JAVA : I want to change this operation into subtraction. What symbol should I choose?
/
-
∥
*
JAVA : What is the output for this operation?
6
7
5
JVM stands for____
Java Volume Member
Java Virtual Machine
Java Vending Machine
None of the above
Java is a/an ___
Structured Programming language
Object-oriented Programming Language
Query Language
All of the above
What is shown in the diagram?
Tea
Coffee
Boiled Water
Acid
Which statement is true about java?
Platform independent programming language
Platform dependent programming language
Code dependent programming language
Sequence dependent programming language
What is the extension of java code files?
.class
.java
.txt
.js
Which company owns Java?
Oracle
Microsoft
Apple
Intel
A. Compile Time Error
B. It will print 'Show'
C. No Output
D. Runtime Error
5 + 5 =
10
0
25
5%5 =
0
25
1
What would be displayed on the console:
System.out.print("Help!")
System.out.println("I forgot my password")
Error
Help! I forgot my password.
Help!
I forgot my password.
(a) number = 10;
(a) result = 10 > 0 ;
(a) name = "ARMY";
(a) .out.println();
(a) number = "12345";
Public static void (a) (String[] args)
(a) Name = 120;
String number = _1234_;
(a)
String surname = "good"_
(a)
Determine the output of this Java program.
(a)
How many times is "Hi.." printed?
10
15
8
Infinite Loop
Java was originally named:
Coffee
Oak
New C++
Duke
What is the name of the Java mascot?
Duke
Ronny
Penguin
James
Jack
Before Java, it is called?
Oak
JavaScript
Jazz
Shrub
A software development environment used for developing Java applications.
Java Runtime Environment
Java Development Kit
Java Compiler
Java Virtual Machine
It is responsible for executing the java program line by line, hence it is also known as an interpreter.
Java Runtime Environment
Java Development Kit
Java Compiler
Java Virtual Machine
