Faculty Of Computers And Information Mansoura 3

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 Mgabr
M
Mgabr
Community Contributor
Quizzes Created: 4 | Total Attempts: 8,382
Questions: 28 | Attempts: 639

SettingsSettingsSettings
Faculty Of Computers And Information Mansoura 3 - Quiz

Faculty of Computers and Information
Mansoura - Universtiy 

Questions for Chapter3 DR / Mohamed Mahfouz
prepared by
 Eng :- Ahmed Eldeep


Questions and Answers
  • 1. 

    What is an Object?

    • A.

      Combination of message and data

    • B.

      Combination of namespace

    • C.

      Combination of task to be performed

    • D.

      Combination of Array

    Correct Answer
    A. Combination of message and data
    Explanation
    An object is a combination of message and data. In object-oriented programming, an object is an instance of a class that can receive messages, perform tasks, and store data. The message represents a request or instruction that is sent to the object, and the data represents the state or properties of the object. By combining both message handling and data storage, objects provide a way to encapsulate behavior and data together, allowing for modular and reusable code.

    Rate this question:

  • 2. 

    What is an Encapsulation?

    • A.

      . An action or occurrence such as click

    • B.

      . A package of one or more components together

    • C.

      . A set of statement that performs specific task

    • D.

      . A reference type variable

    Correct Answer
    B. . A package of one or more components together
    Explanation
    Encapsulation refers to the concept of bundling data and methods together into a single unit, known as a class or object. This allows for the hiding of internal details and the protection of data from outside interference. By encapsulating related components together, it becomes easier to manage and maintain the code, as well as ensuring data integrity and security.

    Rate this question:

  • 3. 

    Which of the following is example of encapsulation

    • A.

      Steering wheel of the car

    • B.

      Car

    • C.

      Color of the car

    • D.

      Music system of the car

    Correct Answer
    B. Car
    Explanation
    The correct answer is "Car" because encapsulation refers to the process of hiding the internal details and exposing only the necessary information to the outside world. In the case of a car, it encapsulates various components such as the engine, transmission, and suspension system, hiding their complexities and providing a simplified interface to the user. The user does not need to know the intricate workings of the car's internal components, but can still interact with it through the exposed features like the steering wheel, accelerator, and brakes.

    Rate this question:

  • 4. 

    Which of the following are not in composition in " Car as a system"

    • A.

      Car and seat covers

    • B.

      Car and music system

    • C.

      Car and color

    • D.

      Car and engine

    Correct Answer
    B. Car and music system
    Explanation
    The correct answer is "Car and music system" because a music system is not an essential component of a car's composition. While a car typically includes features such as seat covers, color, and an engine, a music system is an optional accessory that can be added or removed from the car.

    Rate this question:

  • 5. 

    Is eye color property of human being?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Eye color is a property of human beings. It is determined by the amount and type of pigments present in the iris of the eye. The variation in eye color, such as blue, green, brown, etc., is a result of genetic factors. Eye color is an inherited trait that can be passed down from parents to their offspring. Therefore, it can be considered as a property that distinguishes individuals and is a characteristic of human beings.

    Rate this question:

  • 6. 

    What is a class?

    • A.

      An abstract representation of something with certain properties .

    • B.

      . A concrete representation of something with certain properties .

    • C.

      . An abstract representation of something with certain properties and abilities.

    • D.

      A concrete representation of something with certain properties and abilities.

    Correct Answer
    C. . An abstract representation of something with certain properties and abilities.
    Explanation
    A class is an abstract representation of something with certain properties and abilities. In object-oriented programming, a class is a blueprint or template for creating objects. It defines the properties (attributes) that an object of that class will have, as well as the methods (abilities) that the object can perform. The answer correctly describes a class as an abstract representation, indicating that it is not a concrete or physical entity, but rather a conceptual model. Additionally, it mentions that a class has certain properties and abilities, which aligns with the definition of a class in object-oriented programming.

    Rate this question:

  • 7. 

    Polymorphism reduces the effort required to extend an object system by

    • A.

      Coupling objects together more tightly

    • B.

      . Enabling a number of different operations to share the same name

    • C.

      Making objects more dependent on one another

    • D.

      Removing the barriers imposed by encapsulation.

    Correct Answer
    B. . Enabling a number of different operations to share the same name
    Explanation
    Polymorphism allows different objects to be treated as the same type, even if they have different underlying implementations. This means that different operations can be performed on these objects using the same method name, simplifying the code and reducing the effort required to extend the object system. By enabling multiple operations to share the same name, polymorphism promotes code reuse and flexibility. It does not couple objects together more tightly, make objects more dependent on each other, or remove the barriers imposed by encapsulation.

    Rate this question:

  • 8. 

    Can overloaded methods be override too?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Overloaded methods and overridden methods are two different concepts in object-oriented programming. Overloaded methods have the same name but different parameters within the same class, while overridden methods have the same name and parameters in different classes, where a subclass provides its own implementation of a method that is already defined in its superclass. Therefore, it is possible to have both overloaded and overridden methods in a program.

    Rate this question:

  • 9. 

    Can we override the main method?

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The main method in Java is the entry point of any program. It is a special method that is automatically called when the program starts. Since it is a predefined method in the Java language, it cannot be overridden. Therefore, the correct answer is False.

    Rate this question:

  • 10. 

    Can we create an object for an interface?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Yes, we can create an object for an interface. In Java, an interface is a reference type that can be used to achieve abstraction and multiple inheritance. Although we cannot directly create objects of an interface, we can create objects of a class that implements the interface. These objects can be assigned to the interface type, allowing us to access the methods defined in the interface through the object. This enables us to achieve polymorphism and loose coupling in our code.

    Rate this question:

  • 11. 

    What is the difference between Assignment and Initialization?

    • A.

      Assignment can be done as many times as desired whereas initialization can be done only once.

    • B.

      Assignment can be done only once whereas initialization can be done as many times as desired

    • C.

      . Both are same

    • D.

      None of the above

    Correct Answer
    A. Assignment can be done as many times as desired whereas initialization can be done only once.
    Explanation
    Assignment and initialization are two different concepts in programming. Assignment refers to the process of giving a value to a variable, which can be done multiple times. On the other hand, initialization is the act of giving an initial value to a variable, which can only be done once at the time of declaration. Therefore, the correct answer states that assignment can be done multiple times, while initialization can only be done once.

    Rate this question:

  • 12. 

    What is inner class ?

    • A.

      Classes defined in other classes

    • B.

      Classes defined in methods

    • C.

      Both A & B

    • D.

      Only A

    Correct Answer
    C. Both A & B
    Explanation
    An inner class is a class that is defined within another class. It can be defined within the body of another class or within a method of the outer class. Therefore, the correct answer is both A and B, as inner classes can be defined in other classes as well as in methods.

    Rate this question:

  • 13. 

    What is anonymous class?

    • A.

      Class defined inside a method without a name

    • B.

      It is instantiated and declared in the same place and cannot have explicit constructors

    • C.

      Both A & B

    • D.

      Only A

    Correct Answer
    C. Both A & B
    Explanation
    An anonymous class is a class that is defined inside a method without a name. It can be instantiated and declared in the same place, and it cannot have explicit constructors. Therefore, the correct answer is "Both A & B" because both statements A and B accurately describe an anonymous class.

    Rate this question:

  • 14. 

    Anonymous classes cannot have explicit constructors.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Anonymous classes are defined and instantiated at the same time, without explicitly declaring a class. Since they do not have a class name, they cannot have explicit constructors. Instead, they can only use the default constructor provided by the compiler. Therefore, the statement "Anonymous classes cannot have explicit constructors" is true.

    Rate this question:

  • 15. 

    An inner class can be private.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    An inner class can be declared as private to limit its access only within the outer class. This means that the inner class cannot be accessed or instantiated from outside the outer class. It is often used to encapsulate functionality or data that is only relevant or needed within the context of the outer class. By making the inner class private, it helps to enforce encapsulation and maintain the integrity of the outer class's implementation.

    Rate this question:

  • 16. 

    A method will affect only a particular object to which it is specified.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    This statement is true because when a method is defined in a class, it can only be called on objects of that class. Each object of the class will have its own copy of the instance variables, and when a method is called on a specific object, it will only affect the data within that object. Other objects of the same class will have their own separate data and will not be affected by the method call on a different object.

    Rate this question:

  • 17. 

    What are the advantages of inheritance? 

    • A.

      It permits code reusability. Reusability saves time in program development.

    • B.

      It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional

    • C.

      Both A & B

    • D.

      Only A

    Correct Answer
    C. Both A & B
    Explanation
    Inheritance has two main advantages: code reusability and the ability to reuse proven and debugged software. By inheriting from a parent class, a child class can inherit its methods and attributes, allowing for code reusability and saving time in program development. Additionally, by reusing established and tested software, the chances of encountering problems after a system becomes functional are reduced. Therefore, the correct answer is "Both A & B."

    Rate this question:

  • 18. 

    Polymorphism enables you to program “in the specific” rather than “in the general.”

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Polymorphism enables you to program "in the specific" rather than "in the general" because it allows objects of different classes to be treated as objects of a common superclass. This means that you can write code that operates on the superclass, and it will automatically work with any subclass objects that inherit from it. This allows for more flexible and reusable code, as you can write generic methods that can be used with different types of objects without needing to know their specific implementation details.

    Rate this question:

  • 19. 

    The return data type of void means? 

    • A.

      . A void area in memory is returned so that you can populate it.

    • B.

      No data type is returned

    • C.

      Void is not a valid data type

    • D.

      None of the above

    Correct Answer
    B. No data type is returned
    Explanation
    The return data type of void means that no data type is returned. In programming, when a function or method is declared as void, it indicates that the function does not return any value. This is useful for functions that perform actions or operations without needing to return a result. Therefore, when a function has a void return type, it means that no data type is returned.

    Rate this question:

  • 20. 

    Which statements are not correct about Objects? 

    • A.

      An Object is an instance of a class

    • B.

      Objects can access both instance and static data

    • C.

      All classes extend the Object class

    • D.

      Objects do not permit encapsulation

    Correct Answer
    D. Objects do not permit encapsulation
    Explanation
    The statement that objects do not permit encapsulation is not correct. Encapsulation is a fundamental principle in object-oriented programming that allows data and methods to be bundled together within an object, and objects are the primary way to achieve encapsulation. Objects provide a way to encapsulate data and behavior into a single unit, allowing for better organization and modularity in code.

    Rate this question:

  • 21. 

    If an attribute is private, which methods have access to it?

    • A.

      Only those defined in the same class.

    • B.

      Only static methods in the same class.

    • C.

      Only instance methods in the same class.

    • D.

      Only classes in the same package.

    Correct Answer
    A. Only those defined in the same class.
    Explanation
    If an attribute is private, it means that it can only be accessed within the same class. Other classes or methods outside of the class cannot access this private attribute. Therefore, the correct answer is that only methods defined in the same class have access to the private attribute.

    Rate this question:

  • 22. 

    What is an aggregate object?

    • A.

      An object instance that has only static methods.

    • B.

      An object instance that has only primitive attributes.

    • C.

      An object instance that contains other objects.

    • D.

      An object that has only primitive attributes and instances methods.

    Correct Answer
    C. An object instance that contains other objects.
    Explanation
    An aggregate object is an object instance that contains other objects. This means that the aggregate object is composed of multiple objects, which can be accessed and manipulated through the aggregate object. This allows for a higher level of abstraction and organization in the code, as related objects can be grouped together within the aggregate object.

    Rate this question:

  • 23. 

    A class can have many methods with the same name, as long as the number of parameters is different.  This is known as: 

    • A.

      Method Overloading

    • B.

      Method Invocating

    • C.

      Method Overriding

    • D.

      Method Labeling

    Correct Answer
    A. Method Overloading
    Explanation
    Method overloading is the ability to have multiple methods with the same name in a class, as long as they have a different number of parameters. This allows for flexibility and convenience in programming, as different versions of the same method can be used depending on the number and types of arguments passed. It helps improve code readability and maintainability by grouping related methods under the same name.

    Rate this question:

  • 24. 

    ___________ is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind.  Select the best word to complete this sentence

    • A.

      Class

    • B.

      Inheritance

    • C.

      Polymorphism

    • D.

      Aggregation

    Correct Answer
    A. Class
    Explanation
    A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind. It serves as a template or a blueprint for creating objects of that class. A class encapsulates the data and behavior of an object, allowing multiple instances of the class to be created. It defines the structure and behavior of objects, including their properties (variables) and actions (methods). In object-oriented programming, a class is used to create objects, which are instances of that class.

    Rate this question:

  • 25. 

    -(A/An) ____________ is a contract in the form of a collection of method and constant declarations. When a class implements (a/an) ____________, it promises to implement all of the methods declared in that ____________.  Select the best word to complete this sentence.

    • A.

      Class

    • B.

      Interface

    • C.

      Object

    • D.

      Exception

    Correct Answer
    B. Interface
    Explanation
    An interface is a contract in the form of a collection of method and constant declarations. When a class implements an interface, it promises to implement all of the methods declared in that interface.

    Rate this question:

  • 26. 

    Object Oriented Programming

    • A.

      Makes programs more reliable.

    • B.

      Simulates real life.

    • C.

      Uses a lot of intimidating vocabulary, which is not as bad as it sounds.

    • D.

      Is all of the above.

    Correct Answer
    B. Simulates real life.
    Explanation
    Object Oriented Programming (OOP) simulates real life by allowing programmers to model real-world objects and their interactions. It focuses on encapsulating data and behavior within objects, which can interact with each other through defined interfaces. This approach mirrors how objects in the real world interact and communicate with each other. By simulating real-life scenarios, OOP helps programmers create more intuitive and understandable code, making it easier to design, maintain, and debug applications.

    Rate this question:

  • 27. 

    Object Oriented Programming is characterized by using

    • A.

      Encapsulation

    • B.

      Inheritance

    • C.

      Polymorphism

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    Object Oriented Programming (OOP) is a programming paradigm that focuses on the concept of objects. Encapsulation is one of the key principles of OOP, which involves bundling data and methods together within a class to hide the internal details and provide a clean interface. Inheritance allows classes to inherit properties and methods from other classes, promoting code reusability and creating a hierarchical relationship between classes. Polymorphism enables objects of different classes to be treated as objects of a common superclass, allowing for flexibility and extensibility in the code. Therefore, all of these features - encapsulation, inheritance, and polymorphism - are characteristics of Object Oriented Programming.

    Rate this question:

  • 28. 

    Can abstract classes be inherited?

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    Abstract classes can be inherited. In object-oriented programming, an abstract class is a class that cannot be instantiated and is meant to be subclassed. Subclasses of an abstract class inherit its properties and methods, and they can provide their own implementation for the abstract methods declared in the abstract class. This allows for code reuse and the ability to define common behavior in the abstract class while allowing for customization in the subclasses. Therefore, abstract classes can be inherited by other classes.

    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 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 23, 2011
    Quiz Created by
    Mgabr
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.