
Java Programming Practice Questions
Authored by THRUPAWAI Moe
Computers
University
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
int a = 5, b = 7; System.out.println("Result: " + (a++ + ++b));
Result: 12
Result: 13
Result: 14
Result: 15
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method will correctly determine if two String variables, str1 and str2, contain the exact same sequence of characters?
str1 == str2
str1.equals(str2)
str1.compareTo(str2)
str1.match(str2)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Identify the incorrect statement regarding constructors in Java.
Constructors must have the same name as the class.
Constructors can return any type.
Constructors can be overloaded.
Constructors are used to initialize objects.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
boolean flag = true; if (flag == false) { System.out.println("False"); } else { System.out.println("True"); }
False
True
Compilation Error
Runtime Error
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which keyword in Java is used to prevent method overriding?
static
final
void
private
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Choose the correct way to declare and initialize a one-dimensional integer array.
int arr[] = new int[];
int arr[5] = {1,2,3,4,5};
int[] arr = new int[]{1,2,3,4,5};
int arr = {1,2,3,4,5};
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which access modifier restricts access only within its own class?
public
protected
private
default
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
10 questions
Diagnóstico Páginas Web
Quiz
•
University
15 questions
Computer and Other Human Inventions
Quiz
•
University
10 questions
YT-Quiz
Quiz
•
University
10 questions
Session 2
Quiz
•
University
15 questions
Наукова вікторина
Quiz
•
University
10 questions
T_4.2 Identifier, Data Types, Operators & Expressions
Quiz
•
12th Grade - University
10 questions
IoT Cloud
Quiz
•
University
10 questions
C Programming Quiz-5
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