UGC NET · Computer Science

OOP Previous Year Questions

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.

  • 24 questions
  • Official answer key
  • Free

Other Computer Science topics

Q1UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
A friend function can be used to
  1. Aavoid arguments between classes.
  2. Ballow access to classes whose source code is unavailable.
  3. Callow one class to access an unrelated class.
  4. 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.
  1. AI, II & III
  2. BI & II
  3. CII & III
  4. 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
  1. ACaptureEvents()
  2. BCaptureEvents(Orgs eventType)
  3. CCaptureEvents(eventType)
  4. 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
  1. Acollection of continuous objects that incorporates both data structure and behaviour.
  2. Bcollection of discrete objects that incorporates both discrete structure and behaviour.
  3. Ccollection of discrete objects that incorporates both data structure and behaviour.
  4. 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?
  1. AStatic function
  2. BFriend function
  3. CConst function
  4. 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
  1. ABoxing
  2. BWrapping
  3. CInstantiation
  4. 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?
  1. AAsynchronized methods
  2. BSynchronized methods
  3. CSerialized methods
  4. 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 :
  1. AUsing document object
  2. BRegistering appropriate event handlers
  3. CUsing element object
  4. DAll of the above
Show answerHide answer

Correct answer: (B) Registering appropriate event handlers

Explanation

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)?
  1. AMPI can run on any hardware platform
  2. BThe programming model is a distributed memory model
  3. CAll parallelism is implicit
  4. 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 :
  1. AAbstraction concept
  2. BRefinement concept
  3. CInformation hiding concept
  4. 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?
  1. AInheritance
  2. BPolymorphism
  3. CEncapsulation
  4. 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?
  1. ABoth the statements (1) and (2) are correct
  2. BNeither of the statement (1) and (2) are correct
  3. CStatement (1) is correct and (2) is incorrect
  4. 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 :
  1. A(1) is true
  2. B(2) is true
  3. CBoth (1) and (2) are true
  4. 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?
  1. AMaking atleast one member function as pure virtual function
  2. BMaking atleast one member function as virtual function
  3. CDeclaring as abstract class virtual keyword
  4. 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?
  1. AThe member functions of the class generating friendship can access the members of the friend class.
  2. BAll member functions of the class granted friendship have unrestricted access to the members of the class granting the friendship.
  3. CClass friendship is reciprocal to each other.
  4. 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
  1. AA copy of the object is created
  2. BA copy of the reference is created
  3. CA copy of the reference is not created
  4. 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?
  1. AA function can only be declared a friend by a class itself
  2. BFriend functions are not members of a class, they are associated with it
  3. CFriend functions are members of a class
  4. 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
  1. Athe start of the class.
  2. Bthe start of method declaration.
  3. Cthe start of derived class.
  4. 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?
  1. AEvery class containing abstract method must be declared abstract.
  2. BAbstract class can directly be initiated with 'new' operator.
  3. CAbstract class can be initiated.
  4. 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
  1. AOnly I
  2. BOnly II
  3. CBoth I and II
  4. 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 :
  1. AAdapter
  2. BDecorator
  3. CDelegation
  4. 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.
  1. ANeither I nor II is correct
  2. BBoth I and II are correct
  3. COnly II is correct
  4. 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?
  1. ATranslation and Rotation
  2. BPanning and Zooming
  3. CScaling and Shearing
  4. 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
  1. Aiv i ii
  2. Biii iv ii
  3. Cii iii i
  4. 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.