
Quiz 5
Authored by Ms. Asst.Prof
Computers
University
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
public class Tester {
public static void main(String[] args) {
Tester tester = new Tester();
tester.evaluate(4, 2.5f);
}
public void evaluate(int a, int b) {
System.out.print("First evaluate method invoked");
System.out.println(a + b);
}
public void evaluate(float a, float b) {
System.out.print("Second evaluate method invoked");
System.out.println(a + b);
}
}
First evaluate method invoked 6
Second evaluate method invoked 6.5
Compilation error as two methods with same name cannot exist in the same class
First evaluate method invoked 6.5
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
public class Tester {
public static void main(String[] args) {
Tester tester = new Tester();
tester.evaluate(4.5, 2.5);
}
public void evaluate(int a, int b) {
System.out.print("First evaluate method invoked");
System.out.println(a + b);
}
public void evaluate(float a, float b) {
System.out.print("Second evaluate method invoked");
System.out.println(a + b);
}
}
Second evaluate method invoked 7.0
Compilation error : The method evaluate(int, int) in the type Tester is not applicable for the arguments (double, double)
Second evaluate method invoked 6.0
First evaluate method invoked 6
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following are overloaded methods?
a. public void add(int a, int b) { }
public void add(float a, float b, float c) { }
b. public int add(int a, int b, int c) { }
public float add(int a, int b, int c) { }
c. public float add(float a, int b) { }
public float add(int a, float b) { }
Only a
Only a and c
All a, b and c
Only a and b
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which among the following best describes encapsulation?
one It is a way of combining various data members into a single unit
It is a way of combining various member functions into a single unit
It is a way of combining various data members and member functions into a single unit which can operate on any data
It is a way of combining various data members and member functions that operate on those data members into a single unit
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Encapsulation is also called as?
Data Hidding
Data Hiding
Data Encapsulation
None of the above
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Encapsulation is implemented by using__________
public
private
defalut
protected
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If data members are private, what can we do to access them from the class object?
Create public member functions to access those data members
Create private member functions to access those data members
Create protected member functions to access those data members
Private data members can never be accessed from outside the class
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
13 questions
Chap 1: What is a program made of?
Quiz
•
University
15 questions
Round 2 Debug-The-Code
Quiz
•
University
10 questions
DP-100 Day 2
Quiz
•
University - Professi...
10 questions
Arduino TP02
Quiz
•
University
10 questions
cp06-01-1D-Array
Quiz
•
University
12 questions
Access
Quiz
•
University
15 questions
ARRAYS AND FUNCTIONS
Quiz
•
University
10 questions
Listen in Python
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Computers
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
20 questions
Endocrine System
Quiz
•
University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
30 questions
W25: PSYCH 250 - Exam 2 Practice
Quiz
•
University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University
38 questions
Unit 8 Review - Absolutism & Revolution
Quiz
•
10th Grade - University