
java MCQ

Quiz
•
Computers
•
University
•
Hard
Kashaf Khan
Used 6+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Print the output of following code snippet.
{
int p= 5000;
int q=2000;
while(-- p < ++ q);
System.out.println(p);
}
a) 4999
5000
4989
4888
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class XYZ
{
public static void main(String[] args)
{
short x = 50, Y;
Y = x * 100;
System.out.print(y);
}
}
1
Run time error
5000
Compile time error
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class XYZ
{
public static void main(String[] args) {
String str = "GLBAJAJ";
str = "GLBIAN";
System.out.println(str);
}
}
"GLBAJAJ"
GLBIAN
GLBIAN"
GLBIAN
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class XYZ {
public static void main(String arg[]) {
int i;
for (i = 1; i <= 12; i += 2) {
if (i == 8) {
System.out.println(i);
break;
}
}
}
}
A. No output
2
23232
121
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the purpose of the instanceof operator?
Check if an object is an instance of a specific class or interface
Compare two object references
Check if an object is an instance of a specific class or interface
Multiply instances
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Print the output of following code snippet.
{
int p= 5000;
int q=2000;
while(-- p < ++ q)
System.out.println(p);
}
a) No any output
a) Compile time error
a) Run time error
0
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which method in java is used to generate random numbers in Java?
random.nextInt()
random()
rand()
All of these
Create a free account and access millions of resources
Similar Resources on Wayground
5 questions
Java Classes & Objects

Quiz
•
University
10 questions
exception

Quiz
•
University
10 questions
Java Static

Quiz
•
University
10 questions
Inheritance

Quiz
•
University
9 questions
Java Programming Structures

Quiz
•
University
10 questions
java operators

Quiz
•
University
15 questions
Round 4 - Harvest

Quiz
•
University
6 questions
Quiz on methods

Quiz
•
University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade