Java Basics

Java Basics

University

31 Qs

quiz-placeholder

Similar activities

Weekly Test 2

Weekly Test 2

University

30 Qs

Long Examination 2 - CCPRGG1L

Long Examination 2 - CCPRGG1L

University

26 Qs

OOPS Quiz 2

OOPS Quiz 2

University

29 Qs

Java Programming

Java Programming

University

30 Qs

Test 2

Test 2

University

36 Qs

Code war

Code war

University

30 Qs

java

java

University

28 Qs

Java Quiz 2

Java Quiz 2

University

30 Qs

Java Basics

Java Basics

Assessment

Quiz

Computers

University

Easy

Created by

satyagunadeep patta

Used 1+ times

FREE Resource

31 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is JDK?

Java Development Kit

Java Distribution kit

Java Dont kit

Java Dona Kit

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? ```java System.out.println(2 + "2" + 2); ```
222
6
Error
22

Answer explanation

The first 2 is treated as a number, but when concatenated with a string "2", it becomes a string. So the final result is '222'.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output? ```java System.out.println(10 / 0); ```
Infinity
ArithmeticException
0
Compilation Error

Answer explanation

Division by zero using integers throws an ArithmeticException in Java.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following? ```java for (int i = 0; i < 3; i++) { System.out.print(i + " "); } ```
0 1 2
0 1 2 3
1 2 3
Infinite loop

Answer explanation

The loop runs while i < 3. It prints 0, 1, and 2, then stops.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of this? ```java System.out.println("5 + 5 = " + 5 + 5); ```
5 + 5 = 10
5 + 5 = 55
Error
5 + 5 = 5 + 5

Answer explanation

String concatenation happens first. "5 + 5 = " + 5 is "5 + 5 = 5", then adding another 5 gives "5 + 5 = 55".

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output? ```java System.out.println(2 * 3 + "4" + 5); ```
645
9
345
Error

Answer explanation

2 * 3 is calculated first, giving 6. Then, '6' concatenates with "4" to become "64", and finally adding 5 gives "645".

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? ```java System.out.println(2 + "2" + 2); ```
222
6
Error
22

Answer explanation

The first 2 is treated as a number, but when concatenated with a string "2", it becomes a string. So the final result is '222'.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?