
Java Fundamentals test 2

Quiz
•
Computers
•
10th Grade
•
Medium
Zahra Zahid
Used 1+ times
FREE Resource
22 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What are the different data types in Java?
int, double, char, boolean, classes, interfaces, methods
float, string, byte, long, void, objects
int, double, char, boolean, classes, interfaces, arrays
int, double, char, boolean, float, string, byte
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Explain the difference between int and double data types in Java.
The main difference between int and double data types in Java is that int stores whole numbers, while double stores floating-point numbers with decimal values.
int and double are interchangeable and can be used interchangeably in Java
int is used for text data, while double is used for numerical data
int stores decimal numbers, while double stores whole numbers
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What are the different types of operators in Java?
Comparison
Equality
Shift
Unary
Arithmetic, Relational, Logical, Bitwise, Assignment, Conditional
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the use of the 'if' statement in Java?
The 'if' statement in Java is used to declare a new variable
The 'if' statement in Java is used to make a decision based on a condition.
The 'if' statement in Java is used to define a method
The 'if' statement in Java is used for looping through a set of code multiple times
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How are arrays declared and initialized in Java?
dataType arrayName = new dataType[arraySize];
Arrays in Java are declared using the syntax: arrayName = new dataType[arraySize];
dataType[] arrayName = new dataType[];
Arrays in Java are declared and initialized using the following syntax: dataType[] arrayName = new dataType[arraySize];
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the difference between 'while' and 'do-while' loops in Java?
The main difference is that the 'do-while' loop will always execute the code inside the loop at least once, regardless of the condition.
In 'do-while' loop, the condition is checked at the beginning of the loop, while in 'while' loop, the condition is checked at the end of the loop.
The 'while' loop can only be used for iterating over arrays, while the 'do-while' loop can be used for any type of iteration.
The 'do-while' loop is more efficient than the 'while' loop in terms of memory usage.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Explain the 'for' loop in Java with an example.
Example: for(int i=1; i<=5; i++){ System.out.println(i); }
Example: for(int i=1; i<5; i++){ System.out.println(i); }
Example: for(int i=0; i<5; i++){ System.out.println(i); }
Example: for(int i=5; i>=1; i--){ System.out.println(i); }
Create a free account and access millions of resources
Similar Resources on Wayground
26 questions
Java Syntax Quiz 1

Quiz
•
10th Grade
20 questions
Variables and Loops Review

Quiz
•
9th - 12th Grade
18 questions
GCSE Computer Science Data types

Quiz
•
10th - 12th Grade
23 questions
Java Unit 1 - Quiz Review

Quiz
•
10th Grade
18 questions
COMPUTER 10 FINALS :(

Quiz
•
10th Grade
20 questions
Python variables and operators quiz

Quiz
•
9th - 12th Grade
20 questions
Computer 10 | Introduction to Java

Quiz
•
9th - 12th Grade
20 questions
AP Computer Science A Final Review

Quiz
•
10th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade