
java MCQ
Authored by Kashaf Khan
Computers
University
Used 6+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
DAA Quiz 1
Quiz
•
University
10 questions
python quiz
Quiz
•
6th Grade - Professio...
12 questions
Java History Characteristics Environment
Quiz
•
University
15 questions
Fundamentals of Algorithms - Unit 1 - Test 1
Quiz
•
University
10 questions
Dart
Quiz
•
University
10 questions
LEFT_RIGHT_MID Excel Functions Quiz
Quiz
•
9th Grade - University
10 questions
LINUX MODULE 03 QUIZ
Quiz
•
University
11 questions
Java Quizz 2
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade