
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
20 questions
Quiz Inf X.B
Quiz
•
10th Grade - University
20 questions
DWDM-2
Quiz
•
University
20 questions
HCI - UCD
Quiz
•
University
16 questions
Python Basics
Quiz
•
KG - University
20 questions
Python Recap
Quiz
•
7th Grade - University
20 questions
IT Essential UIUX Chapter 1 & 2
Quiz
•
University
20 questions
SECOND QUIZ
Quiz
•
University
20 questions
Chapter 3: Strategic Initiatives for implementing CA
Quiz
•
University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University
