stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Java Spring 2025 Midterm Review Flashcards | StudBud
Explore
/
Java Spring 2025 Midterm Review
Java Spring 2025 Midterm Review
20 terms
·
StudBud Administration
·
2 plays
Test your knowledge on basic concepts of Java programming and data structures.
Flashcards
20 cards
F
Practice quiz
P
Host live
L
Questions
20
Answers
1
Which of these is not a primitive type?
boolean
int
String
char
2
What is the default value of a boolean variable in Java?
true
null
0
false
3
The "double" data type is used for true or false values?
True
False
4
A "for" loop can declare a counter variable that controls the number of iterations.
False
True
5
What is the purpose of the 'return' statement in a method?
To print a value to the console
To create a new method
To exit the method and send back a value
To call another method
6
What is the purpose of a switch statement?
Select a case
Declare variables
Loop through values
End a program
7
Which of these is a valid array declaration?
arr int[];
int[] arr;
array int[];
int arr[];
8
True or false: Java is case-sensitive.
True
False
9
In Java, which of the following is necessary to use a Scanner for input?
import Scanner
import java.util.*
import java.util.Scanner
import java.io.Scanner
10
True or false: Arrays can hold different data types.
True
False
11
What is an array?
Random data type
Single value storage
Function container
Collection of values
12
What does 'break' do in loops?
Restarts the loop
Pauses the loop
Ends the loop
Skips an iteration
13
Which loop is best for known iterations?
Infinite loop
Do-while loop
For loop
While loop
14
A "while" loop is a control structure for repeated execution as long as a condition is true.
False
True
15
Which loop runs at least once?
Do-while loop
While loop
Nested loop
For loop
16
In Java, which of the following statements is true about arrays?
Arrays can grow dynamically
Arrays can only store integers
Arrays are fixed in size after they are created
Arrays always need to be initialized with zero
17
How do you correctly start a 'for' loop in Java?
for(int i = 0; i < 10) + 1
for(int i; 0 to 10)
for(int i = 0; i < 10; i++)
for(i = 0; i < 10)
18
Which of these is a valid operator for concatenation of strings in Java?
+
*
&
$
19
What is the correct syntax to declare an array of integers in Java?
int numbers[ ];
int[ ] numbers;
Array numbers;
int numbers = new int( );
20
Which method is used to read input from the console in Java?
System.in.read( )
Scanner.next( ) method
System.out.read( )
Scanner.input( )