[go: up one dir, main page]

0% found this document useful (0 votes)
80 views9 pages

s2 Summative Keys For Ccs0023

The document contains 20 multiple choice questions about object-oriented programming concepts like method overloading, object creation, the Scanner class, inheritance, encapsulation, and constructor calls. It tests knowledge of when method overloading is determined, how to print numbers in Java, and which type of variables can be accessed from different scopes. Most questions have a single correct answer about basic OOP terminology and features.

Uploaded by

Jayvee Tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views9 pages

s2 Summative Keys For Ccs0023

The document contains 20 multiple choice questions about object-oriented programming concepts like method overloading, object creation, the Scanner class, inheritance, encapsulation, and constructor calls. It tests knowledge of when method overloading is determined, how to print numbers in Java, and which type of variables can be accessed from different scopes. Most questions have a single correct answer about basic OOP terminology and features.

Uploaded by

Jayvee Tan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 9

 

Question 1
1 / 1 pts
When does method overloading is determined?

  
At execution time
 

  
At coding time
 

  
At compile time
 

  
At run time
 
 
IncorrectQuestion 2
0 / 1 pts
Which of following statement(s) can result in new object instance creation if executed
successfully.

  
String str = "VirtuQ" + " "+ Simplifying Education";

  
int [] arr = {1,2,3,4,5};
 

  
All
 

  
String str = new String();
 

  
String str = new String("VirtuQ");
 
IncorrectQuestion 3
0 / 1 pts
The Scanner class contains a method called ___________ that reads user input that is
a integer.

  
Println
 

  
NextInt
 

  
pow
 

  
Length()
 
 
IncorrectQuestion 4
0 / 1 pts
Sally is continuing work on her Object-Oriented Program and is writing code for a car,
truck, and bus. These items under the class called vehicle are referred to as _____.

  
methods
 

  
objects
 

  
items
 

  
attributes
 
 
Question 5
1 / 1 pts
How do I print out numbers on JAVA?

  
System.out.println('#');

  
System.out.println("#");

  
System.out.println(false);
 

  
System.out.println(#);
 
 
Question 6
1 / 1 pts
Accessor (Getter) – a method that is used to access or retrieve data.

  
false
 

  
true
 
 
Question 7
1 / 1 pts
a variable that is accessible from all classes.

  
public variable
 

  
protected variable
 

  
private variable
 
 
Question 8
1 / 1 pts
this – contains a reference to the current object being constructed
  
false
 

  
true
 
 
IncorrectQuestion 9
0 / 1 pts
static Variables are variables stored in the class and are available to all objects of a
class or objects of other classes if access is permitted

  
false
 

  
true
 
 
Question 10
1 / 1 pts
a variable that is only accessible within a class where it is declared

  
private variable
 

  
public variable
 

  
protected variable
 
 
Question 11
1 / 1 pts
In Inheritance, the programmer can change one part of the code without affecting other
parts

  
true
 

  
false
 
 
Question 12
1 / 1 pts
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
 
 
IncorrectQuestion 13
0 / 1 pts
Encapsulation is also called as?

  
Data Hiding
 

  
Data Hidding
 

  
Data Encapsulation
 

  
None of the choices
 
 
Question 14
1 / 1 pts
Encapsulation is the way to add functions in a user defined structure.

  
True
 

  
False
 
 
Question 15
1 / 1 pts
Using encapsulation data security is ___________

  
Purely ensured
 

  
Very low
 

  
Not ensured
 

  
Ensured to some extent
 
 
Question 16
1 / 1 pts
Which type of inheritance cannot involve private inheritance?

  
All types can have private inheritance
 

  
Multiple
 
  
Hybrid
 

  
Single level
 
 
Question 17
1 / 1 pts
Which constructor will be called first from the classes involved in single inheritance from
object of derived class?

  
Derived class constructor
 

  
Both class constructors at a time
 

  
Base class constructor
 

  
Runtime error
 
 
Question 18
1 / 1 pts
Single level inheritance will be best for___________

  
Inheriting a class which can print all the calculation results
 

  
Inheriting a class which can perform and print all calculations
 

  
Inheriting a class which performs all the calculations
 

  
Inheriting all the classes for different calculations
 
 
Question 19
1 / 1 pts
If single inheritance is used, program will contain ________________

  
Exactly 2 classes
 

  
At least 2 classes
 

  
At most 4 classes
 

  
At most 2 classes
 
 
Question 20
1 / 1 pts
Which among the following is correct for the following code?

class A

    public : class B

    {

        public : B(int i): data(i)

        {

        }
        int data;

You might also like