Java 1 (with bitwise and shift)

Java 1 (with bitwise and shift)

University

32 Qs

quiz-placeholder

Similar activities

JAVA BASIC 2

JAVA BASIC 2

University

35 Qs

java collections

java collections

University

31 Qs

Java Assessment-1

Java Assessment-1

University

30 Qs

Coding Competation(Round 1)

Coding Competation(Round 1)

University

30 Qs

blitz

blitz

University

30 Qs

CCP1102-Java Programming-Prelim

CCP1102-Java Programming-Prelim

University

30 Qs

IT OLYMPAID

IT OLYMPAID

University

30 Qs

CodeChef (Secret Snippet)

CodeChef (Secret Snippet)

University

35 Qs

Java 1 (with bitwise and shift)

Java 1 (with bitwise and shift)

Assessment

Quiz

Computers

University

Medium

Created by

Det Det

Used 1+ times

FREE Resource

32 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the two main types of data types in Java?
Primitive and Composite
Primitive and Reference
Integer and Floating-point
Static and Dynamic

Answer explanation

Java has primitive data types (e.g., int, boolean) and reference data types (e.g., objects, arrays).

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a primitive data type in Java?
int
float
String
boolean

Answer explanation

String is a reference type, not a primitive.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default value of a reference variable in Java?
0
null
"" (empty string)
Undefined

Answer explanation

Reference variables default to null, meaning they do not reference an object until initialized.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the size of an int in Java?
8 bits
16 bits
32 bits
64 bits

Answer explanation

Java int is always 32-bit signed.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will System.out.println(10 / 4); print?
2
2.5
3
2

Answer explanation

Integer division truncates the decimal, so 10 / 4 results in 2.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will System.out.println(5 & 3); print?
1
2
3
5

Answer explanation

5 in binary = 0101, 3 in binary = 0011. 0101 & 0011 = 0001 (which is 1).

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will System.out.println(true || false && false); print?
true
false
Compilation error
NullPointerException

Answer explanation

&& has higher precedence than ||, so it evaluates as true || (false && false) → true || false → true.

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?