AOOP REVIEWER
80 Questions
39 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does the term 'encapsulation' refer to in object-oriented programming?

  • The restriction of access to an object's data. (correct)
  • The definition of attributes and behaviors in a class.
  • The process of creating an object from a class.
  • The ability of an object to perform actions on its own.
  • What are 'attributes' in the context of object-oriented programming?

  • The instances created from a class.
  • The interactions between different objects.
  • The methods that define an object's capabilities.
  • The characteristics or properties of an object. (correct)
  • Which keyword is used to refer to the current instance of a class?

  • this (correct)
  • current
  • self
  • instance
  • What is a constructor in object-oriented programming?

    <p>A special method called to create an instance of a class.</p> Signup and view all the answers

    How does the concept of 'abstraction' benefit users?

    <p>By hiding unnecessary details from the user.</p> Signup and view all the answers

    Which of the following components primarily defines the behavior of an object?

    <p>Methods</p> Signup and view all the answers

    What does the term 'anthropomorphic' mean in relation to objects?

    <p>Objects need direction from others to function.</p> Signup and view all the answers

    Which statement best describes the relationship between classes and objects?

    <p>A class is a blueprint, and an object is an instance of that blueprint.</p> Signup and view all the answers

    What does polymorphism in object-oriented programming allow?

    <p>Assigning a subclass to its superclass type.</p> Signup and view all the answers

    Which keyword is used to relate a field to the class and not to the instance?

    <p>static</p> Signup and view all the answers

    What type of relationship does aggregation represent?

    <p>Two objects are independently associated but can exist separately.</p> Signup and view all the answers

    What does the 'extends' keyword signify in Java?

    <p>Inheritance from a parent class.</p> Signup and view all the answers

    Which of the following is a purpose of using generics in Java?

    <p>To provide abstraction over types.</p> Signup and view all the answers

    What does the Serializable interface enable in Java?

    <p>Converting an object's state into a byte stream.</p> Signup and view all the answers

    Which of these is NOT an advantage of the MVC architecture?

    <p>Difficulties in testing individual components.</p> Signup and view all the answers

    What is the primary role of the Model in the MVC architecture?

    <p>To manage the core functionality and data logic.</p> Signup and view all the answers

    Which of the following best describes a composition relationship?

    <p>One object relies on the other for its existence.</p> Signup and view all the answers

    What is the purpose of the serialVersionUID in Java?

    <p>To ensure that objects are serialized correctly.</p> Signup and view all the answers

    Which keyword is used to make a field or method visible only to subclasses?

    <p>protected</p> Signup and view all the answers

    What does the term 'interface' in Java refer to?

    <p>A set of method signatures with no implementations.</p> Signup and view all the answers

    How are generic bounds defined in Java?

    <p>Using the 'extends' keyword for upper bounds.</p> Signup and view all the answers

    What method does the View implement to apply changes from models?

    <p>void update(Observable obj, Object data)</p> Signup and view all the answers

    Which component is responsible for managing user interactions in the MVC architecture?

    <p>Controller</p> Signup and view all the answers

    Which of the following best describes an Inner Class?

    <p>A class defined inside another class.</p> Signup and view all the answers

    What is the primary purpose of the Observable class in Java?

    <p>To notify observers when the model changes.</p> Signup and view all the answers

    Which of the following is NOT a responsibility of a Database Management System (DBMS)?

    <p>Data Encryption</p> Signup and view all the answers

    Which SQL command is used to create a new database?

    <p>CREATE DATABASE database_name;</p> Signup and view all the answers

    What type of inner class is usually nameless and used once?

    <p>Anonymous Inner Class</p> Signup and view all the answers

    Which operation is NOT part of the CRUD functionality of SQL?

    <p>Store</p> Signup and view all the answers

    What does the term 'Serialization' refer to in programming?

    <p>The conversion of an object into a byte stream.</p> Signup and view all the answers

    In the context of a database table, what do columns represent?

    <p>Attributes or characteristics of the entity.</p> Signup and view all the answers

    What is the main feature of Data Definition Language (DDL)?

    <p>Creates and manipulates database objects.</p> Signup and view all the answers

    Which term describes the process of an application client creating a connection to a database using JDBC?

    <p>Database Connectivity</p> Signup and view all the answers

    Which of the following scenarios would most likely use an Anonymous Inner Class?

    <p>Implementing a unique listener for a button click.</p> Signup and view all the answers

    Which of the following accurately describes the role of the Model component in MVC architecture?

    <p>It contains the data and business logic of the application.</p> Signup and view all the answers

    What is the primary function of the garbage collection thread in Java?

    <p>To free any memory that is no longer needed</p> Signup and view all the answers

    Which primitive data type in Java has the smallest size?

    <p>byte</p> Signup and view all the answers

    In Java, which access modifier allows a subclass to access variables, methods, and constructors from a superclass?

    <p>protected</p> Signup and view all the answers

    What is referred to as the process where a subclass provides a specific implementation of a method already defined in its parent class?

    <p>Method overriding</p> Signup and view all the answers

    What is the default value of a char variable in Java?

    <p>'\u0000'</p> Signup and view all the answers

    Which data type is suitable for storing whole numbers in a database?

    <p>INT</p> Signup and view all the answers

    What does the UNIQUE constraint ensure for a database field?

    <p>Field values must be unique across instances</p> Signup and view all the answers

    What is the purpose of the DELETE command in SQL?

    <p>To remove rows from a table</p> Signup and view all the answers

    What does the AUTO_INCREMENT feature do in a database field?

    <p>Increments the field's value automatically with each new entry</p> Signup and view all the answers

    Which SQL statement retrieves all data of students in their first year?

    <p>SELECT * FROM students WHERE year_level = 1;</p> Signup and view all the answers

    What SQL command would you use to increment the year level of all 'Information Technology' students by 1?

    <p>UPDATE students SET year_level = year_level + 1 WHERE program = 'Information Technology';</p> Signup and view all the answers

    Which type of JDBC driver is characterized by not requiring any code installed on the client?

    <p>Type 3: JDBC-Net pure Java</p> Signup and view all the answers

    Which SQL command will permanently erase a database instance?

    <p>DROP DATABASE</p> Signup and view all the answers

    What is the result of executing 'DELETE FROM students;' without a WHERE clause?

    <p>Removes all rows from the students table</p> Signup and view all the answers

    Which SQL function would you use to retrieve distinct program names for students whose names start with 'X'?

    <p>SELECT DISTINCT program FROM students WHERE name LIKE 'X%';</p> Signup and view all the answers

    What is the primary purpose of the JDBC Driver?

    <p>To connect Java programs to a database</p> Signup and view all the answers

    What constraint would you use to ensure a field in a table can never be left empty?

    <p>NOT NULL</p> Signup and view all the answers

    Which command is used in SQL to add new rows to a table?

    <p>INSERT</p> Signup and view all the answers

    In the context of SQL, what does the term 'Data Manipulation Language (DML)' refer to?

    <p>A language for manipulating data within the database</p> Signup and view all the answers

    What does the executeUpdate() method return when executing an INSERT statement?

    <p>An int representing affected rows</p> Signup and view all the answers

    What is the purpose of a ResultSet in Java Database Connectivity?

    <p>To hold data retrieved from a database</p> Signup and view all the answers

    Which method is recommended to ensure that database connections are closed?

    <p>close() in a finally block</p> Signup and view all the answers

    In a multithreaded application, how do threads primarily share memory?

    <p>By sharing access to the same memory space</p> Signup and view all the answers

    What does the run() method in a Thread class do?

    <p>Initiates the thread's execution</p> Signup and view all the answers

    Which mechanism is now considered the correct way to stop a thread in Java?

    <p>Using a boolean variable in the run method</p> Signup and view all the answers

    Which of the following is a state of a thread?

    <p>Running</p> Signup and view all the answers

    What is the default priority assigned to a thread in Java?

    <p>5</p> Signup and view all the answers

    What is one drawback of using a simple scheduling algorithm for thread execution?

    <p>It can lead to thread starvation.</p> Signup and view all the answers

    What is a common purpose of the yield() method in Java threading?

    <p>To release CPU time voluntarily</p> Signup and view all the answers

    Which interface is commonly used to create threads in a way that allows more flexibility than subclassing the Thread class?

    <p>Runnable</p> Signup and view all the answers

    Why should the stop() method not be used in thread management?

    <p>It can lead to deadlocks.</p> Signup and view all the answers

    What does the setPriority(int aPriority) method do for a thread?

    <p>Defines the order in which threads are executed</p> Signup and view all the answers

    What happens when a thread cannot obtain a lock on a synchronized method?

    <p>The thread goes into the wait queue until the lock becomes available</p> Signup and view all the answers

    Which method can be used to allow a thread to voluntarily relinquish the CPU?

    <p>yield()</p> Signup and view all the answers

    What is the purpose of the sleep(time) method?

    <p>To stop the thread execution for a specific amount of milliseconds</p> Signup and view all the answers

    What does synchronization ensure within synchronized methods?

    <p>That only one thread can access critical data at a time</p> Signup and view all the answers

    What must be done to a method to make it synchronized in Java?

    <p>Add the synchronized modifier</p> Signup and view all the answers

    Which of the following best describes the states of a thread?

    <p>Created, Running, Blocked, Dead</p> Signup and view all the answers

    What describes a class in the context of object-oriented programming?

    <p>A blueprint from which objects are created</p> Signup and view all the answers

    What keyword is used to create a subclass from a parent class?

    <p>extends</p> Signup and view all the answers

    What is method overriding?

    <p>Changing the implementation of a method in a subclass with the same name</p> Signup and view all the answers

    Which statement correctly reflects the relationship between classes and interfaces in Java?

    <p>Classes can implement multiple interfaces</p> Signup and view all the answers

    What does the term 'polymorphism' refer to in programming?

    <p>The ability to present the same interface for different underlying forms</p> Signup and view all the answers

    What describes an association relationship in terms of object orientation?

    <p>One object relies on another object for its functionality</p> Signup and view all the answers

    Which of the following best describes abstraction in object-oriented programming?

    <p>Hiding complex details and showing only essential features</p> Signup and view all the answers

    Study Notes

    Topic 1: Generics

    • Generics allow objects to accept different types of parameters instead of being limited to a specific type.
    • A generic parameter, like T in a generic method, can accept any data type.

    Topic 2: Generic Method Syntax Example

    • The provided code snippet demonstrates a generic method copy that copies elements from one array (src) to another (dest).
    • The method takes two arrays as input: src (source) and dest (destination).
    • S and T are type parameters, indicating the types of elements in the source and destination arrays.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    goodluck

    More Like This

    Generics Concepts Flashcards
    7 questions
    Java Generic Classes Overview
    36 questions
    Generic Programming in Java
    24 questions

    Generic Programming in Java

    WellBredConsciousness5838 avatar
    WellBredConsciousness5838
    Use Quizgecko on...
    Browser
    Browser