
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
10 questions
Intro-Computação_3.3
Quiz
•
University
10 questions
แบบทดสอบหุ่นยนต์ระดับกลางเบื้องต้น
Quiz
•
6th Grade - University
10 questions
Programacion Orientada a Objetos
Quiz
•
12th Grade - University
11 questions
C Language
Quiz
•
10th Grade - University
10 questions
Java Quiz 1
Quiz
•
University
10 questions
Quiz ECIH Week 4
Quiz
•
University
15 questions
The Genius of Alan Turing
Quiz
•
10th Grade - University
10 questions
Cybersecurity Fundamentals Week 6 Quiz
Quiz
•
KG - 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
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th 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