Font size
WorksheetsJava Quiz I- B
Total questions: 31
Worksheet time: 10mins
What is the correct syntax to output "HelloWorld" in Java?
(a)
JVM stands for
Java Vital Machine
Java Virtual Machine
Java Vendor machine
Java programs ________________
are only compiled
are only compiled not interpreted
are only interpreted
are both compiled and interpreted
In Java, execution starts from ___________ function.
get()
main()
java()
display()
Java is
platform dependent
platform indeprndent
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
JDK stands for
Java Developer Kit
Java Development Kit
Java Design Kit
Java Debugging Kit
Java was developed by
James gosling
John gosling
James frank
John frank
ar, given the following declaration:int[] ar = {2, 4, 6, 8 }0, 1, 2, 31, 2, 3, 40, 2, 4, 6What is the first index of an array?
1
0
2
3
What would the new value of A be?
A=1;
a++;
1
2
3
4
What's the value of below?
int i=5;
System.out.println(i++);
System.out.println(i);
System.out.println(++i);
5
6
7
6
6
7
6
7
8
5
5
6
Find the output of the following snippet.
class Numbers
{
public static void main(String args[])
{
int a=20, b=10;
if((a<b)&&(b++ <25))
{
System.out.println("this is any language logic");
}
System.out.println(b);
}
}
10
12
11
Compilation Error
Below are conditional statements in Java, except:
if
switch
else
if else
Which of the condition below that is just the same with the output program.
Print "Hello World" if x is greater than y.
x>y
y<x
y>x
x<y
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 stars are printed?
7
3
4
5
Infinite Loop
In total, how many times is the inner loop executed?
5
10
15
50
Infinite Loop
How many times does the loop print a *
40
20
24
30
Infinite Loop
What does the following code print?
A rectangle of 8 rows with 5 stars per row
A rectangle of 8 rows with 4 stars per row
A rectangle of 6 rows with 5 stars per row
A rectangle of 6 rows with 4 stars per row
Infinite Looo
What does the following code print?
A rectangle of 9 rows with 5 stars per row
A rectangle of 6 rows with 6 stars per row
A rectangle of 7 rows with 5 stars per row
A rectangle of 7 rows with 6 stars per row
Infinite Loop
How many times does the following method print a *?
9
6
7
10
10
15
17
22
25
int count = 0;
while (count < 10) {
System.out.println("Welcome to Java");
count++;
}
Predict the output?
public class Main {
public static void main(String args[]) {
int arr[] = {10, 20, 30, 40, 50};
for(int i=0; i < arr.length; i++)
{
System.out.print(" " + arr[i]);
}
}
}
10 20 30 40 50
Compiler Error
10 20 30 40
class Test {
public static void main(String args[]) {
int arr[2];
System.out.println(arr[0]);
System.out.println(arr[1]);
}
}
0
0
garbage value
garbage value
Compiler Error
Exception
what is the output of this question?
class Test1 {
public
static void main(String[] args)
{
int x = 20;
System.out.println(x);
}
static
{
int x = 10;
System.out.print(x + " ");
}
}
10 20
20 10
10 10
20 20
Polymorphism related to :
PPO
Class
OPP
OOP
Which one is correct?
public static main(Strings[] args) { }
public private static main(Strings[] args) { }
public static void main(Strings[] args) { }
public void static main(Strings[] args) { }
