
Java Programming Practice Questions

Quiz
•
Computers
•
University
•
Medium
THRUPAWAI Moe
Used 3+ times
FREE Resource
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
Similar Resources on Wayground
15 questions
Java Bootcamp Day 4

Quiz
•
University
15 questions
Python

Quiz
•
University
20 questions
Set - 1

Quiz
•
University
15 questions
Java Programming

Quiz
•
University
20 questions
Python Complete course test

Quiz
•
University
10 questions
C Programming Quiz-1

Quiz
•
University
10 questions
PSP Week3

Quiz
•
University
10 questions
JAVA III

Quiz
•
University
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
11 questions
NFL Football logos

Quiz
•
KG - Professional Dev...
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
38 questions
Unit 6 Key Terms

Quiz
•
11th Grade - University
20 questions
La Hora

Quiz
•
9th Grade - University
7 questions
Cell Transport

Interactive video
•
11th Grade - University
7 questions
What Is Narrative Writing?

Interactive video
•
4th Grade - University