
Java Programming Practice Questions
Quiz
•
Computers
•
University
•
Practice Problem
•
Medium
THRUPAWAI Moe
Used 3+ times
FREE Resource
Enhance your content in a minute
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
Create a free account and access millions of resources
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
18 questions
SAINS KOMPUTER TING 4 - 1.5 AMALAN TERBAIK PENGATURCARAAN
Quiz
•
12th Grade - University
10 questions
python quiz
Quiz
•
6th Grade - Professio...
20 questions
POO_BasicoyJava
Quiz
•
University
10 questions
TIU Quiz-4
Quiz
•
University
12 questions
Java History Characteristics Environment
Quiz
•
University
20 questions
Control Structures C#
Quiz
•
University
15 questions
IT Quiz
Quiz
•
University
10 questions
Analysis of Algorithms
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
