
Java Program

Quiz
•
Computers
•
University
•
Hard
PUSHPALATHA C2114
Used 3+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
1.What will be the output of following Java code?
public class Main { public static void main(String[] args) { String str = "Hello"; str = "Bye"; System.out.println(str); } }
Hello
Bye
Error
All of these
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
2.public class Main { public static void main(String arg[]) { int i; for (i = 1; i <= 12; i += 2) { if (i == 8) { System.out.println(i); break; } } } }
1
No output
8
1357911
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
3.What will be the output of the following Java code?
class increment {
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
a) 32
b) 33
c) 24
d) 25
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
4.What will be the output of the following Java program?
class variable_scope
{
public static void main(String args[])
{
int x;
x = 5;
{
int y = 6;
System.out.print(x + " " + y);
}
System.out.println(x + " " + y);
}
}
a) Compilation error
b) Runtime error
c) 5 6 5 6
d) 5 6 5
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
5.What will be the output of the following Java code snippet?
class abc
{
public static void main(String args[])
{
if(args.length>0)
System.out.println(args.length);
}
}
a) The snippet compiles and runs but does not print anything
b) The snippet compiles, runs and prints 0
c) The snippet compiles, runs and prints 1
d) The snippet does not compile
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
6.What will the following loop print?
for(int i = 0; i < 4; i++) { System.out.println(i); }
A.0 1 2
B.1 2 3
C.0 1 2 3
D.None
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
7.What is the output of this code?
int x = 1; while(x < 4) { System.out.println(x); x++; }
A.1 2 3
B.2 3 4
C.1 2 3 4
D.1
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
C#.net test 1

Quiz
•
University
15 questions
Coding club Summit Online Quiz

Quiz
•
University
10 questions
G12_Week7

Quiz
•
12th Grade - University
15 questions
CODE ZENITH

Quiz
•
University
10 questions
Weekly Contest #3 - TechXNinjas

Quiz
•
University
8 questions
Java operators

Quiz
•
University
5 questions
Programming in Java - Output Prediction

Quiz
•
University
15 questions
Soal Java

Quiz
•
11th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University