
Java Program
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
PUSHPALATHA C2114
Used 3+ times
FREE Resource
Enhance your content in a minute
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);
}
}
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
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
15 questions
Data Security Worksheet
Quiz
•
10th Grade - University
15 questions
Cara Kerja Komputer dan Fungsinya
Quiz
•
University
14 questions
LA5.C5: Branching and Subroutines
Quiz
•
9th Grade - University
10 questions
T02: Python - The Basics
Quiz
•
University
13 questions
Guess the Retro Computer 1
Quiz
•
KG - Professional Dev...
10 questions
Kuis Sensor 1
Quiz
•
University
11 questions
Determining System Requirements
Quiz
•
University
15 questions
1.1.1 The structure and function of the processor
Quiz
•
11th Grade - 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
