Online Examination System 2012

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Farhan786
F
Farhan786
Community Contributor
Quizzes Created: 1 | Total Attempts: 317
Questions: 20 | Attempts: 317

SettingsSettingsSettings
Online Examination System 2012 - Quiz

Hello Every Student? ? ?


Questions and Answers
  • 1. 

    Consider a linked list implemented of a queue with two pointers: front and rear. What is the time needed to insert element in a queue of length of n? 

    • A.

      O(log2n)

    • B.

      O(n).

    • C.

      O(n log2n).

    Correct Answer
    A. O(log2n)
    Explanation
    The correct answer is O(n). In a linked list implementation of a queue, inserting an element involves updating the rear pointer to point to the new element. This operation takes constant time, regardless of the length of the queue. Therefore, the time complexity for inserting an element in a queue of length n is O(1), not O(log2n).

    Rate this question:

  • 2. 

    Time taken for addition of element in queue is 

    • A.

      None of these

    • B.

      O(n)

    • C.

      O(n)

    Correct Answer
    B. O(n)
    Explanation
    The time taken for the addition of an element in a queue is O(n). This means that the time complexity is directly proportional to the number of elements in the queue. As the number of elements increases, the time taken for adding an element also increases. This is because in a queue, new elements are added at the rear end, and if the queue is already full, additional memory needs to be allocated and all the existing elements need to be shifted to accommodate the new element. Therefore, the time complexity for adding an element in a queue is O(n).

    Rate this question:

  • 3. 

    The statement that tests to see if sum is equal to 10 and total is less than 20, and if so, prints the text string "incorrect.", is 

    • A.

      if( (sum = 10) && (total < 20) )printf(

    • B.

      if( (sum == 10) && (total < 20) )printf(

    • C.

      if( (sum == 10) ¦¦ (total < 20) )printf(

    Correct Answer
    C. if( (sum == 10) ¦¦ (total < 20) )printf(
    Explanation
    The correct answer is "if( (sum == 10) ¦¦ (total < 20) )printf(". This statement checks if the variable "sum" is equal to 10 and the variable "total" is less than 20. If both conditions are true, it will print the text string "incorrect". The double vertical bar "¦¦" represents the logical OR operator, which means that if either condition is true, the overall expression will be true.

    Rate this question:

  • 4. 

    Consider a linked list of n elements. What is the time taken to insert an element pointer ? 

    • A.

      O(n log2n)

    • B.

      O(nlogn)

    • C.

      N log n

    Correct Answer
    A. O(n log2n)
    Explanation
    The time taken to insert an element pointer in a linked list of n elements is O(n log2n). This means that the time complexity of the insertion operation is directly proportional to the number of elements in the linked list, multiplied by the logarithm (base 2) of the number of elements. This suggests that as the number of elements in the linked list increases, the time taken to insert an element pointer will also increase, but at a slower rate than linearly.

    Rate this question:

  • 5. 

    Which is a logical abstract base class for a class called "footballPlayer"? 

    • A.

      Tenis

    • B.

      Team.

    • C.

      Cricket

    Correct Answer
    B. Team.
    Explanation
    The logical abstract base class for a class called "footballPlayer" would be "Team". This is because a football player is typically a part of a team and the team serves as the higher-level concept or category that the football player belongs to.

    Rate this question:

  • 6. 

    Can two classes contain member functions with the same name? 

    • A.

      No

    • B.

      Sometimes

    • C.

      Yes, but only if the two classes have the same name.

    Correct Answer
    C. Yes, but only if the two classes have the same name.
    Explanation
    Yes, two classes can contain member functions with the same name, but only if the two classes have the same name. This is because member functions are identified by their class name, so if two classes have the same name, their member functions can have the same name as well. However, if the classes have different names, their member functions must also have different names to avoid conflicts.

    Rate this question:

  • 7. 

    A derived class is

    • A.

      Inherits data members and member functions from base class.

    • B.

      Object can access protected members with the dot operator.

    • C.

      Inherits data members and member functions from base class as well as Inherits constructors and destructor.

    Correct Answer
    A. Inherits data members and member functions from base class.
    Explanation
    A derived class is a class that inherits data members and member functions from a base class. This means that the derived class can access and use the same data members and member functions as the base class. It does not inherit constructors and destructors, as those are specific to each class and need to be defined separately.

    Rate this question:

  • 8. 

    _________is a relationship 

    • A.

      Polymorphism

    • B.

      Inheritance

    • C.

      OverLoading

    Correct Answer
    B. Inheritance
    Explanation
    Inheritance is a relationship in object-oriented programming where one class inherits the properties and methods of another class. This allows the subclass to reuse the code from the superclass and add its own unique functionality. Inheritance promotes code reusability, as it allows for the creation of specialized classes that inherit common attributes and behaviors from a more general class.

    Rate this question:

  • 9. 

    Which is a logical abstract base class for a class called "CricketPlayer"? 

    • A.

      Team

    • B.

      Sports

    • C.

      Cricket

    Correct Answer
    C. Cricket
    Explanation
    The logical abstract base class for a class called "CricketPlayer" would be "Sports" or "Team". This is because a cricket player is a type of sports player and is also a member of a team. However, "Cricket" cannot be the logical abstract base class as it represents the specific sport itself, rather than a general category that includes the concept of a cricket player.

    Rate this question:

  • 10. 

    Maintaining the state of an object is called____. 

    • A.

      Serialization

    • B.

      Persistence

    • C.

      Marshalling

    Correct Answer
    A. Serialization
    Explanation
    Serialization is the process of converting an object into a format that can be stored, transmitted, or reconstructed later. It involves converting the object's state into a byte stream, which can then be saved to a file or sent over a network. By serializing an object, its state is maintained and can be restored at a later time. Therefore, serialization is the correct answer for the given question.

    Rate this question:

  • 11. 

    ______ means that both the data and the methods which may access it are defined together in the same unit. 

    • A.

      Data hiding.

    • B.

      Encapsulation

    • C.

      Data Binding

    Correct Answer
    B. Encapsulation
    Explanation
    Encapsulation means that both the data and the methods which may access it are defined together in the same unit. This allows for better organization and control over the data, as it is encapsulated within the unit and only accessible through the defined methods. This helps to prevent direct access to the data from external sources and ensures that any changes to the data are done through the appropriate methods, providing better security and maintainability of the code.

    Rate this question:

  • 12. 

    If a catch statement is written to catch exception objects of a base class type, it can also catch all _____ derived from that base class 

    • A.

      Object

    • B.

      Class

    • C.

      Exceptions for objects

    Correct Answer
    C. Exceptions for objects
    Explanation
    If a catch statement is written to catch exception objects of a base class type, it can also catch all exceptions derived from that base class. This is because when an exception is derived from a base class, it inherits the properties and behaviors of that base class. Therefore, if a catch statement is designed to catch exceptions for objects, it will be able to handle any exception object that is derived from the base class.

    Rate this question:

  • 13. 

    Association in UML can be represented by: 

    • A.

      A plane line with no shape on either end.

    • B.

      Diamond shape between classes.

    • C.

      A line with an arrow-head pointing in direction of parent or superclass.

    Correct Answer
    A. A plane line with no shape on either end.
    Explanation
    In UML, association represents a relationship between two classes. It is depicted by a plane line with no shape on either end. This indicates that there is a connection between the two classes, but it does not specify the nature or direction of the relationship. The absence of any shape on either end signifies that the association is not navigable from either class.

    Rate this question:

  • 14. 

    Suppose that the Test class does not have an overloaded assignment operator. What happens when an assignment a=b; is given for two Test objects a and b? 

    • A.

      The automatic assignment operator is used

    • B.

      The copy constructor is used

    • C.

      Run-time error

    Correct Answer
    B. The copy constructor is used
    Explanation
    When an assignment a=b; is given for two Test objects a and b, the copy constructor is used. This is because in the absence of an overloaded assignment operator, the default assignment operator provided by the compiler performs a member-wise copy of the data from the source object (b) to the destination object (a). This requires the use of the copy constructor to create a new object (a) with the same values as the source object (b).

    Rate this question:

  • 15. 

    Peer-to-peer relationship is a type of _________. 

    • A.

      1) Association

    • B.

      2) Aggregation

    • C.

      3) Link

    Correct Answer
    C. 3) Link
    Explanation
    A peer-to-peer relationship refers to a type of connection or link between two or more peers, where each peer has equal privileges and responsibilities. This relationship is characterized by a decentralized structure, where peers can communicate and share resources directly with each other without the need for a central authority. Therefore, the correct answer is "Link".

    Rate this question:

  • 16. 

    An application uses encapsulation to achieve ________

    • A.

      Information hiding

    • B.

      Make implementation independent

    • C.

      Minimizing interdependencies among modules

    Correct Answer
    A. Information hiding
    Explanation
    Encapsulation is a concept in object-oriented programming that involves bundling data and methods together into a single unit called an object. This helps in achieving information hiding, where the internal details and implementation of an object are hidden from the outside world. By encapsulating data and methods, an application can control access to its internal state and ensure that it is only accessed and modified through defined methods. This helps in maintaining data integrity and allows for easier maintenance and modification of the code. Therefore, the correct answer is information hiding.

    Rate this question:

  • 17. 

    A class is_____ 

    • A.

      Data Type

    • B.

      Abstract Type

    • C.

      User Defined Type

    Correct Answer
    B. Abstract Type
    Explanation
    An abstract type refers to a class that cannot be instantiated directly, but serves as a base for other classes to inherit from. It provides a common interface and defines common behavior that derived classes can implement. Abstract types are typically used to define common characteristics and behavior for a group of related classes.

    Rate this question:

  • 18. 

    Can two classes contain member functions with the same name?

    • A.

      No.

    • B.

      Yes, but only if the main program does not declare both kinds.

    • C.

      Yes, this is always allowed.

    Correct Answer
    C. Yes, this is always allowed.
    Explanation
    Yes, this is always allowed. In object-oriented programming, it is possible for two classes to contain member functions with the same name. This is known as function overloading, where different classes can have functions with the same name but different parameters or return types. The compiler can differentiate between these functions based on their signatures, allowing for more flexible and expressive code.

    Rate this question:

  • 19. 

      In object orientated programming a class of objects can _____________ properties from another class of objects 

    • A.

      Utilize

    • B.

      Inherit

    • C.

      Adapt

    Correct Answer
    A. Utilize
    Explanation
    In object-oriented programming, when a class of objects "utilizes" properties from another class of objects, it means that it is using or making use of those properties. This can be done through inheritance, where one class inherits the properties and methods of another class. By utilizing the properties, the class can access and manipulate the data or behavior defined in the other class, making the code more efficient and reusable.

    Rate this question:

  • 20. 

    Reusability can be achieved through. 

    • A.

      Inheritance.

    • B.

      Composition.

    • C.

      Association.

    Correct Answer
    B. Composition.
    Explanation
    Composition is a design principle in object-oriented programming that allows objects to be composed of other objects. It promotes reusability by creating relationships between classes where one class contains another class as a member variable. This allows the containing class to reuse the functionality of the contained class without inheriting from it. Inheritance, on the other hand, allows for code reuse by creating a parent-child relationship between classes. Association is a looser relationship between classes that allows objects to interact, but does not promote code reuse in the same way as composition. Therefore, composition is the correct answer for achieving reusability.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 26, 2012
    Quiz Created by
    Farhan786

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.