24 OOP (Computer Science) questions asked in UGC NET previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.
Q1UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
A friend function can be used to
Aavoid arguments between classes.
Ballow access to classes whose source code is unavailable.
Callow one class to access an unrelated class.
Dnone of the above
Show answerHide answer
Correct answer: (C) allow one class to access an unrelated class.
Explanation
Unrelated class means the classes are not connected via inheritance. But a relation can be achieved between two unrelated classes through friend function.
Q2UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Object Request Broker (ORB) is
I. A software program that runs on the client as well as on the application server.
II. A software program that runs on the client side only.
III. A software program that runs on the application server, where most of the components reside.
AI, II & III
BI & II
CII & III
DI only
Show answerHide answer
Correct answer: (D) I only
Explanation
Object request broker (ORB) is middleware that uses the CORBA (Common Object Request Broker Architecture) specification. The ORB takes care of all of the details in routing a request from client to object and the response to its destination. ORB runs on clients as well as on the application server.
Q3UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
The syntax of capturing events method for document object is
ACaptureEvents()
BCaptureEvents(Orgs eventType)
CCaptureEvents(eventType)
DCaptureEvents(eventVal)
Show answerHide answer
Correct answer: (C) CaptureEvents(eventType)
Explanation
CaptureEvents (EventType) method instructs the window to capture all events of a particular type.
Q4UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
Superficially the term "object-oriented", means that, we organize software as a
Acollection of continuous objects that incorporates both data structure and behaviour.
Bcollection of discrete objects that incorporates both discrete structure and behaviour.
Ccollection of discrete objects that incorporates both data structure and behaviour.
Dcollection of objects that incorporates both discrete data structure and behaviour.
Show answerHide answer
Correct answer: (C) collection of discrete objects that incorporates both data structure and behaviour.
Explanation
Object oriented development makes software closet to abstractions the exists in the real world and the term object oriented means that software is a collection of discrete objects that incorporate both data structure and behaviour.
Q5UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
Which of the following is not a member of class?
AStatic function
BFriend function
CConst function
DVirtual function
Show answerHide answer
Correct answer: (B) Friend function
Explanation
A friend function of a class is a non-member function that is given the same access as member methods to the class's private and protected data. It is declared inside the class that grants access, but it is not a member of the class.
Q6UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
Converting a primitive type data into its corresponding wrapper class object instance is called
ABoxing
BWrapping
CInstantiation
DAutoboxing
Show answerHide answer
Correct answer: (D) Autoboxing
Explanation
Autoboxing is the automatic conversion that the Java compiler makes from primitive types to their corresponding object wrapper classes.
Q7UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
Which methods are utilized to control the access to an object in multi-threaded programming?
AAsynchronized methods
BSynchronized methods
CSerialized methods
DNone of the above
Show answerHide answer
Correct answer: (B) Synchronized methods
Explanation
Synchronization is the capability to control the access of multiple threads to shared resources. Without it, one Java thread could modify a shared variable while another thread is using or updating the same variable; synchronized methods prevent this.
Q8UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
The behavior of the document elements in XML can be defined by :
A JavaScript program can define the behaviour of document elements by registering appropriate event handlers.
Q9UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Which of the following is not valid with reference to message passing interface (MPI)?
AMPI can run on any hardware platform
BThe programming model is a distributed memory model
CAll parallelism is implicit
DMPI - Comm. - size returns the total number of MPI processes in specified communication
Show answerHide answer
Correct answer: (C) All parallelism is implicit
Explanation
Message passing interface (MPI) is a standardized and portable message passing system. • It can run on any hardware platform. It is portable, efficient, flexible. • It has become a de facto standard for communication among memory system. • MPI – Comm. – Size returns the total number of MPI processes in specified communication. So answer is (c)
Q10UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Cohesion is an extension of :
AAbstraction concept
BRefinement concept
CInformation hiding concept
DModularity
Show answerHide answer
Correct answer: (C) Information hiding concept
Explanation
A cohesion module performs a single task within a software procedure, requiring little interaction with little procedures in other parts of software. Type of cohesion : • A module that performs takes that are related logically is logically cohesion • When a module contains takes that are related by the fact that all must be executed with the same span of time, the exhibits temporal cohesion • At the low end of the spectrum, a module that performs a set of takes that relate to each other loosely called coincidentally cohesive.
Q11UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Module design is used to maximize cohesion and minimize coupling. Which of the following is the key to implement this rule?
AInheritance
BPolymorphism
CEncapsulation
DAbstraction
Show answerHide answer
Correct answer: (C) Encapsulation
Explanation
The golden rule in module design is to maximize cohesion and minimize coupling. Encapsulation is the key to implementing this rule.
Q12UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
Consider the following two statements :
(1) A publicly derived is a subtype of base class
(2) Inheritance provides for code ruse
Which one of the following statements is correct?
ABoth the statements (1) and (2) are correct
BNeither of the statement (1) and (2) are correct
CStatement (1) is correct and (2) is incorrect
DStatement (1) is incorrect and (2) is correct
Show answerHide answer
Correct answer: (A) Both the statements (1) and (2) are correct
Explanation
Inheritance provides for code reuse, and public inheritance creates a subtype: a publicly derived class is a subtype of its base class. Both statements are correct.
Q13UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
Which of the following is/are correct with reference to abstract class and interface?
(1) A class can inherit only one Abstract class but may inherit several interfaces
(2) An Abstract class can provide complete and default code but an interface has no code
Codes :
A(1) is true
B(2) is true
CBoth (1) and (2) are true
DNeither (1) nor (2) is true
Show answerHide answer
Correct answer: (C) Both (1) and (2) are true
Explanation
An interface is an empty shell: there are only the signatures of the methods, which do not have a body, so statement (2) is true. A class can extend only a single class, whereas it can implement multiple interfaces, so statement (1) is true.
Q14UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
Which of the following is used to make an Abstract class?
AMaking atleast one member function as pure virtual function
BMaking atleast one member function as virtual function
CDeclaring as abstract class virtual keyword
DDeclaring as Abstract class static keyword
Show answerHide answer
Correct answer: (A) Making atleast one member function as pure virtual function
Explanation
To make a class abstract, at least one member function should be made a pure virtual function.
Q15UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Which one of the following is correct, when a class grants friend status to another class?
AThe member functions of the class generating friendship can access the members of the friend class.
BAll member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.
CClass friendship is reciprocal to each other.
DThere is no such concept.
Show answerHide answer
Correct answer: (B) All member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.
Explanation
The member functions of a class which is given friend status by another class can access all private, protected and public members of the class granting friendship. Class friendship is neither reciprocal (commutative) nor transitive unless explicitly specified.
Q16UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
When one object reference variable is assigned to another object reference variable then
AA copy of the object is created
BA copy of the reference is created
CA copy of the reference is not created
DIt is illegal to assign one object reference variable to another object reference variable
Show answerHide answer
Correct answer: (B) A copy of the reference is created
Explanation
Assigning one object reference variable to another copies only the reference (address), not the object. Both variables then refer to the same object; no distinct copy of the object is created. So a copy of the reference is created.
Q17UGC NET Computer Science, August 2016 (Paper II & III, Selected Questions)
If a function is friend of a class, which one of the following is wrong?
AA function can only be declared a friend by a class itself
BFriend functions are not members of a class, they are associated with it
CFriend functions are members of a class
DIt can have access to all members of the class, even private ones
Show answerHide answer
Correct answer: (C) Friend functions are members of a class
Explanation
A friend function of a class is defined outside that class's scope but has the right to access all private and protected members of the class. Even though the prototypes for friend functions appear in the class definition, friends are not member functions.
Q18UGC NET Computer Science, August 2016 (Paper II & III, Selected Questions)
Method over-riding can be prevented by using final as a modifier at
Athe start of the class.
Bthe start of method declaration.
Cthe start of derived class.
Dthe start of the method declaration in the derived class.
Show answerHide answer
Correct answer: (B) the start of method declaration.
Explanation
To disallow a method from being overridden, specify final as a modifier at the start of its declaration. Methods declared as final cannot be overridden.
Q19UGC NET Computer Science, August 2016 (Paper II & III, Selected Questions)
Which of the following is not a correct statement?
AEvery class containing abstract method must be declared abstract.
BAbstract class can directly be initiated with 'new' operator.
CAbstract class can be initiated.
DAbstract class does not contain any definition of implementation.
Show answerHide answer
Correct answer: (B) Abstract class can directly be initiated with 'new' operator.
Explanation
An abstract class cannot be directly instantiated with the new operator; since an abstract class does not contain a complete implementation, it is not possible to create an abstract object.
Q20UGC NET Computer Science, June 2017 (Paper II & III, Selected Questions)
Which of the following statements (s) regarding a linker software is/are true?
I. A function of a linker is to combine several object modules into a single load module.
II. A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules
AOnly I
BOnly II
CBoth I and II
DNeither I nor II
Show answerHide answer
Correct answer: (A) Only I
Explanation
Statement I is true: a linker combines several object modules into a single load module. Statement II is wrong: a linker replaces symbolic references by addresses (it generates relocatable addresses), not absolute references by symbolic ones.
Q21UGC NET Computer Science, June 2017 (Paper II & III, Selected Questions)
A software design pattern used to enhance the functionality of an object at run-time is :
AAdapter
BDecorator
CDelegation
DProxy
Show answerHide answer
Correct answer: (B) Decorator
Explanation
In object-oriented programming, the decorator pattern (also known as wrapper) is a design pattern that allows behaviour to be added to an individual object, statically or dynamically at run-time, without affecting the behaviour of other objects of the same class.
Q22UGC NET Computer Science, June 2017 (Paper II & III, Selected Questions)
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.
ANeither I nor II is correct
BBoth I and II are correct
COnly II is correct
DOnly I is correct
Show answerHide answer
Correct answer: (A) Neither I nor II is correct
Explanation
The book's solution: encapsulation allows us to focus on what something does without considering the complexities of how it works, and abstraction allows us to consider complex ideas while ignoring irrelevant details that would confuse us. Hence, as per the book, neither statement is correct.
Q23UGC NET Computer Science, June 2017 (Paper II & III, Selected Questions)
A segment is any object described by GKS commands and data that start with CREATE SEGMENT and Terminates with CLOSE SEGMENT command. What function can be performed on these segments?
ATranslation and Rotation
BPanning and Zooming
CScaling and Shearing
DTranslation, Rotation, Panning and Zooming
Show answerHide answer
Correct answer: (D) Translation, Rotation, Panning and Zooming
Explanation
A GKS segment is any object described by GKS commands and data that start with CREATE SEGMENT and terminate with CLOSE SEGMENT. Segments allow objects to be manipulated by simply referring to the segment number, so segments can be translated, rotated, panned and zoomed.
Q24UGC NET Computer Science, November 2017 (Paper II & III, Selected Questions)
In the architecture of 8085 microprocessor match the following :
A. Processing unit
B. Instruction unit
C. Storage and Interface unit
i. Interrupt
ii. General purpose Register
iii. ALU
iv. Timing and control
Code :
A B C
Aiv i ii
Biii iv ii
Cii iii i
Di ii iv
Show answerHide answer
Correct answer: (B) iii iv ii
Explanation
The ALU forms the processing unit (A-iii); timing and control belongs to the instruction unit (B-iv); the general-purpose registers are in the storage and interface unit (C-ii).
How to use these UGC NET Computer Science questions
Every question here was asked in a real UGC NET paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full UGC NET papers as timed tests to check your speed under exam conditions.