
Quiz 5

Quiz
•
Computers
•
University
•
Hard
Ms. Asst.Prof
Used 1+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
6 questions
Java array

Quiz
•
11th Grade - University
10 questions
Core Java Quiz

Quiz
•
University
10 questions
Methods

Quiz
•
University
10 questions
Third Year Placement Training Revision Test

Quiz
•
University
10 questions
Week 4: Recap Java Programming

Quiz
•
University
15 questions
nesne tabanlı

Quiz
•
10th Grade - University
10 questions
C Program Array and strings

Quiz
•
University
10 questions
csharp

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University