
Java syntax
Quiz
•
Computers
•
University
•
Practice Problem
•
Easy
Wayground Content
Used 3+ times
FREE Resource
Enhance your content in a minute
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What symbol is used to end a Java statement?
.
;
:
!
Answer explanation
Java statements end with a semicolon (;).
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
How many primitive data types does Java have?
6
7
8
9
Answer explanation
Java has 8 primitive data types: byte, short, int, long, float, double, char, and boolean.
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What happens if a local int variable is used without initialization?
It is initialized to 0.
It retains a garbage value.
It causes a compilation error.
It is initialized to -1.
Answer explanation
"Local variables in Java must be explicitly initialized before use, as they do not have default values. Attempting to use an uninitialized local variable results in a compilation error.
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the size of the 'int' data type in Java?
2 bytes
4 bytes
8 bytes
16 bytes
Answer explanation
The 'int' data type in Java occupies 4 bytes (32 bits).
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will this print?
int x = 5; int y = 3; System.out.println(x - y);
1
2
3
4
Answer explanation
The difference between x (5) and y (3) is 2.
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Identify the error in this code:
int num; System.out.println(num);
Variable not initialized
Syntax error in declaration
Variable out of scope
Data type mismatch
Answer explanation
Local variables like num must be explicitly initialized before use.
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of this code? System.out.println("Java " + "Programming");
Java Programming
Java & Programming
JavaProgramming
Programming in Java
Answer explanation
The + operator concatenates the two strings, resulting in Java Programming.
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
Algoritma dan Pemrograman Bab 1
Quiz
•
University
15 questions
Human Computer Interaction (HCI)
Quiz
•
University
16 questions
Gerência do Processador
Quiz
•
University
20 questions
Infrastructure (Network)
Quiz
•
University
20 questions
C Quest 2.0
Quiz
•
University
20 questions
PHP First Internal Practical Viva
Quiz
•
University
19 questions
Quiz sobre Estructuras Selectivas en Java
Quiz
•
12th Grade - University
15 questions
Assessment 08
Quiz
•
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
