Java Objects - Medium Practice Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
VIKAS BANDARU
Used 1+ times
FREE Resource
Enhance your content in a minute
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which statement best describes a parameterised constructor in OOP?
Answer explanation
A parameterised constructor takes arguments and assigns initial values to fields when an object is created.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given: String s = "0123456789"; System.out.println(s.substring(4)); What is printed?
Answer explanation
substring(4) returns characters from index 4 to end, yielding 456789.
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Given: String s = "0123456789"; System.out.println(s.substring(s.lastIndexOf('3'), s.indexOf('8'))); What is printed?
Answer explanation
lastIndexOf('3') is 3, indexOf('8') is 8; substring(3,8) gives 34567.
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Given:
String s = "abcabc";
System.out.println(s.lastIndexOf("abc", 2));
System.out.println(s.substring(3, 3).length());
What is printed on two lines?
Answer explanation
lastIndexOf("abc", 2) searches up to index 2 inclusive, finds abc at 0; substring(3,3) is empty, length is 0.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which option correctly identifies a parameterised method that also returns a value?
Answer explanation
moveHorizontal(int distance) both takes a parameter and could be defined to return an int; among given options, it matches signature of parameterised and returning method.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider class Account { int balance; Account(int initial){ balance = initial + 50; } } After Account a = new Account(150); what is a.balance?
Answer explanation
The parameterised constructor sets balance = initial + 50, so 150 + 50 = 200.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In Circle, which method changes position based on caller-provided information?
Answer explanation
moveHorizontal changes xPosition using the distance provided by the caller.
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
20 questions
ตอบปัญหาคอมพิวเตอร์st
Quiz
•
9th - 12th Grade
20 questions
Compito Excel No SE
Quiz
•
12th Grade
15 questions
Osnove elektrotehnike
Quiz
•
9th - 12th Grade
20 questions
City & Guilds Award in Business Processes
Quiz
•
12th Grade
21 questions
CPA MS-Office Hotkeys Quiz
Quiz
•
8th Grade - Professio...
17 questions
ICT Service Solutions 2
Quiz
•
8th - 12th Grade
20 questions
2TPR_UD3_Electricidad (Parte1)
Quiz
•
12th Grade
16 questions
LATIHAN PTS _ANIMASI 3D
Quiz
•
1st - 12th Grade
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...
15 questions
Christmas Song Emoji Pictionary
Quiz
•
7th - 12th Grade
20 questions
Christmas Movies
Quiz
•
1st - 12th Grade
55 questions
CHS Holiday Trivia
Quiz
•
12th Grade
20 questions
Christmas Movie Trivia
Quiz
•
9th - 12th Grade
29 questions
christmas facts
Lesson
•
5th - 12th Grade
20 questions
Christmas Trivia
Quiz
•
5th - 12th Grade
20 questions
Stages of Meiosis
Quiz
•
9th - 12th Grade
