OOP Concepts


12
Question 1
Which one of the following are essential features of an object-oriented programming language? (GATE CS 2005) (i) Abstraction and encapsulation (ii) Strictly-typedness (iii) Type-safe property coupled with sub-type rule (iv) Polymorphism in the presence of inheritance Answer (b) Abstraction, Encapsulation, Polymorphism and Inheritance are the essential features of a OOP Language (See the Wiki page for OOP).
A
(i) and (ii) only
B
(i) and (iv) only
C
(i), (ii) and (iv) only
D
(i), (iii) and (iv) only
GATE-CS-2005    OOP Concepts    
Discuss it


Question 1 Explanation: 
Abstraction, Encapsulation, Polymorphism and Inheritance are the essential features of a OOP Language (See the Wiki page for OOP).
Question 2
It is desired to design an object-oriented employee record system for a company. Each employee has a name, unique id and salary. Employees belong to different categories and their salary is determined by their category. The functions to get Name, getld and compute salary are required. Given the class hierarchy below, possible locations for these functions are: i. getld is implemented in the superclass ii. getld is implemented in the subclass iii. getName is an abstract function in the superclass iv. getName is implemented in the superclass v. getName is implemented in the subclass vi. getSalary is an abstract function in the superclass vii. getSalary is implemented in the superclass viii. getSalary is implemented in the subclass Choose the best design
A
(i), (iv), (vi), (viii)
B
(i), (iv), (vii)
C
(i), (iii), (v), (vi), (viii)
D
(ii), (v), (viii)
OOP Concepts    GATE-CS-2004    
Discuss it


Question 2 Explanation: 
Question 3
Consider the following class definitions in a hypothetical Object Oriented language that supports inheritance and uses dynamic binding. The language should not be assumed to be either Java or C++, though the syntax is similar.
Class P
{
    void f(int i)
    {
        print(i);
    }
}

Class Q subclass of P
{
    void f(int i)
    {
        print(2*i);
    }
}
Now consider the following program fragment:
P x = new Q();
Q y = new Q();
P z = new Q();
x.f(1); ((P)y).f(1); z.f(1); 
Here ((P)y) denotes a typecast of y to P. The output produced by executing the above program fragment will be
A
1 2 1
B
2 1 1
C
2 1 2
D
2 2 2
OOP Concepts    GATE-CS-2003    
Discuss it


Question 4
Match the following concepts and their best possible descriptions.<br> 2006_53
A
i-b, ii-d, iii-e, iv-f, v-g, vi-a
B
i-c, ii-a, iii-e, iv-d, v-h, vi-f
C
i-c, ii-f, iii-h, iv-a, v-g, vi-d
D
i-b, ii-e, iii-c, iv-f, v-g, vi-s
OOP Concepts    GATE IT 2006    
Discuss it


Question 5
Which one of the following are essential features of object oriented language? A. Abstraction and encapsulation B. Strictly-typed C. Type-safe property coupled with sub-type rule D. Polymorphism in the presence of inheritance
A
A and B only
B
A, D and B only
C
A and D only
D
A, C and D only
OOP Concepts    ISRO CS 2017    
Discuss it


Question 5 Explanation: 
Refer: GATE-CS-2005 | Question 4 Option (C) is correct.
Question 6
Which of the following is associated with objects?
A
State
B
Behaviour
C
Identity
D
All of the above
OOP Concepts    ISRO CS 2017 - May    
Discuss it


Question 7
Abstraction and encapsulation are fundamental principles that underlie the object oriented approach to software development. What can you say about the following two statements ? I. Abstraction allows us to focus on what something does without considering the complexities of how it works. II. Encapsulation allows us to consider complex ideas while ignoring irrelevant detail that would confuse us.
A
Neither I nor II is correct.
B
Both I and II are correct.
C
Only II is correct.
D
Only I is correct.
OOP Concepts    UGC NET CS 2017 Jan - III    
Discuss it


Question 7 Explanation: 
Encapsulation allows us to focus on what something does without considering the complexities of how it works. Abstraction allows us to consider complex ideas while ignoring irrelevant detail that would confuse us. So, option (A) is correct.
Question 8
Consider the following two statements: (a)A publicly derived class is a subtype of its base class. (b)Inheritance provides for code reuse.
A
Both the statements (a) and (b) are correct.
B
Neither of the statements (a) and (b) are correct
C
Statement (a) is correct and (b) is incorrect
D
Statement (a) is incorrect and (b) is correct.
OOP Concepts     UGC NET CS 2015 Dec - II    
Discuss it


Question 8 Explanation: 
  • A publicly derived class is a subtype of its base class.
  • Inheritance provides for code reuse.
So, option (A) is correct.
Question 9
Which of the following statements regarding the features of the object-oriented approach to databases are true? (a)The ability to develop more realistic models of the real world. (b)The ability to represent the world in a non-geometric way. (c)The ability to develop databases using natural language approaches. (d)The need to split objects into their component parts. (e)The ability to develop database models based on location rather than state and behaviour. Codes:
A
(a), (b) and (c)
B
(b), (c) and (d)
C
(a), (d) and (e)
D
(c), (d) and (e)
OOP Concepts    UGC NET CS 2015 Dec – III    
Discuss it


Question 9 Explanation: 
Features of the object-oriented approach to databases: The ability to develop more realistic models of the real world. The ability to represent the world in a non-geometric way. The ability to develop databases using natural language approaches. So, option (A) is correct.
Question 10
The feature in object-oriented programming that allows the same operation to be carried out differently, depending on the object, is:
A
Inheritance
B
Polymorphism
C
Overfunctioning
D
Overriding
OOP Concepts    ISRO CS 2009    
Discuss it


There are 12 questions to complete.
12


My Personal Notes arrow_drop_up


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.