Unit 1 - Object-Oriented Programming
33 Questions
0 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 is the primary purpose of a constructor in object-oriented programming?

  • To define the characteristics of a class.
  • To specify the actions an object can perform.
  • To create new objects from a class. (correct)
  • To provide additional information about the source code.
  • Which term best describes a named set of instructions that perform a specific action in a class?

  • Parameter
  • Object
  • Attribute
  • Method (correct)
  • What is the role of a 'parameter' when defining a method?

  • To define the type of value a method receives when it is called. (correct)
  • To determine whether a block of code will execute.
  • To define the name of the method.
  • To specify the return data type of a method.
  • What does the term 'instantiate' mean in object-oriented programming?

    <p>To call the constructor in order to create an object. (C)</p> Signup and view all the answers

    What is the significance of a 'void' return type when defining a method?

    <p>It indicates the method does not have a return value. (A)</p> Signup and view all the answers

    In object-oriented programming, what is a 'subclass'?

    <p>A class that inherits from another class. (B)</p> Signup and view all the answers

    What is the purpose of a 'tester class' in a program?

    <p>To contain the starting point of program execution. (B)</p> Signup and view all the answers

    What is the role of a 'dot operator' in programming?

    <p>To call a method of a class. (C)</p> Signup and view all the answers

    What does a 'commit' operation do in the context of programming?

    <p>It saves the latest code changes as a snapshot. (B)</p> Signup and view all the answers

    Which of the following best describes the concept of a 'programming style'?

    <p>A set of rules for formatting program code consistently. (D)</p> Signup and view all the answers

    What is the primary purpose of a 'selection statement' in programming?

    <p>To execute code only when specified conditions are true. (D)</p> Signup and view all the answers

    In software development, what is the 'DRY principle' aimed at?

    <p>Reducing repetition in code. (C)</p> Signup and view all the answers

    What is the concept of 'encapsulation' primarily focused on in object-oriented programming?

    <p>Hiding instance variables and accessing them through methods. (C)</p> Signup and view all the answers

    What is the primary function of an accessor method?

    <p>To return the current value of an instance variable. (C)</p> Signup and view all the answers

    What does the process of 'decomposition' refer to in programming?

    <p>Breaking down a complex problem into smaller, manageable parts. (B)</p> Signup and view all the answers

    Which of the following best describes a parameterized constructor?

    <p>A constructor that accepts a specific number of arguments to initialize object variables. (C)</p> Signup and view all the answers

    What is the primary function of an 'access modifier' in programming?

    <p>To set the visibility of classes, variables, and methods. (C)</p> Signup and view all the answers

    What is meant by the term 'scope' in the context of programming?

    <p>The part of the program where a variable can be accessed and used. (D)</p> Signup and view all the answers

    What is the main objective of 'refactoring' in software development?

    <p>To improve the structure and readability of code, without altering functionality. (A)</p> Signup and view all the answers

    When is an operator considered a 'compound assignment operator'?

    <p>When it combines an operation and an assignment in a single step. (C)</p> Signup and view all the answers

    What is the main purpose of a mutator method?

    <p>To change the current values of instance variables. (B)</p> Signup and view all the answers

    In the context of strings, what does 'concatenation' refer to?

    <p>Joining two or more strings together to form a single new string. (D)</p> Signup and view all the answers

    What is a 1D array?

    <p>A data structure that holds multiple values of the same data type in a linear manner. (C)</p> Signup and view all the answers

    What is the role of an 'index' when referring to a data structure?

    <p>It indicates the specific location of a value within the data structure. (A)</p> Signup and view all the answers

    Which of the following best describes a 'loop control variable'?

    <p>A variable that determines the number of times a loop is executed based on a constant value. (A)</p> Signup and view all the answers

    When does a postcondition need to be true?

    <p>Just after a code segment has completed execution. (D)</p> Signup and view all the answers

    What does it mean to 'cast' a variable in programming?

    <p>To assign a value of one data type to another. (B)</p> Signup and view all the answers

    What is an 'alias' in the context of variables?

    <p>A reference variable that points to the same object as another reference variable. (A)</p> Signup and view all the answers

    Which of the following best describes short-circuited evaluation in Boolean expressions?

    <p>A process where evaluation of a logical expression stops when the result is clear, even before the entire expression is computed. (B)</p> Signup and view all the answers

    What distinguishes a 'static method' from an 'instance method'?

    <p>A static method can be called without creating an object, whereas an instance method requires an object of the class. (A)</p> Signup and view all the answers

    In a two-dimensional array, what does a 'row' represent?

    <p>A horizontal (left to right) series of data. (A)</p> Signup and view all the answers

    Which of the following is a good description of an 'off-by-one error'?

    <p>An error caused by a loop iterating one time too many or one time too few. (A)</p> Signup and view all the answers

    Signup and view all the answers

    Flashcards

    String literal

    A sequence of characters enclosed in quotation marks. They are used to represent text in programs.

    Syntax error

    A mistake in the code that does not follow the programming language's rules.

    Method

    A named set of instructions that perform a task.

    Class

    A programmer-defined template used to create objects. Defines the attributes and behaviors.

    Signup and view all the flashcards

    Argument

    The specific value provided when calling a method or constructor.

    Signup and view all the flashcards

    Attribute

    A characteristic of an object.

    Signup and view all the flashcards

    Code review

    The process of examining code and providing feedback to improve its quality and functionality.

    Signup and view all the flashcards

    Constructor

    A block of code that has the same name as the class. It tells the computer how to create a new object.

    Signup and view all the flashcards

    Access Modifier

    A keyword used to set the visibility of classes, variables, constructors, and methods in a program.

    Signup and view all the flashcards

    Decomposition

    The process of breaking down a problem into smaller, manageable parts to write methods for each part.

    Signup and view all the flashcards

    Actual Parameter

    The value to assign to a formal parameter when calling a method or constructor.

    Signup and view all the flashcards

    Encapsulation

    An object-oriented programming concept where the instance variables of a class are hidden from other classes and can be accessed only through the methods of the class.

    Signup and view all the flashcards

    Pseudocode

    A plain language description of the steps in an algorithm.

    Signup and view all the flashcards

    DRY Principle

    A software development principle that stands for "Don't Repeat Yourself" which aims to reduce repetition in code.

    Signup and view all the flashcards

    Local variable

    A variable declared inside a specific block of code that can only be accessed within that block.

    Signup and view all the flashcards

    Default Value

    A predefined value that is used by a program when the user does not provide a value.

    Signup and view all the flashcards

    Parameterized constructor

    A constructor that takes arguments to assign values to an object's instance variables.

    Signup and view all the flashcards

    State

    The attributes of an object, represented by its instance variables.

    Signup and view all the flashcards

    Scope

    The scope of a variable determines where in a program it can be accessed.

    Signup and view all the flashcards

    Initialization

    Initialization is the process of giving an initial value to a variable using the assignment operator ( = ) .

    Signup and view all the flashcards

    Accessor method

    Accessor methods are used to get the current value assigned to an instance variable.

    Signup and view all the flashcards

    Library

    A collection of prewritten codes that can be used in other programs.

    Signup and view all the flashcards

    Mutator method

    A method that changes the value of a specific instance variable in an object.

    Signup and view all the flashcards

    Relational operators

    These operators are used to compare values or expressions, resulting in a true or false value.

    Signup and view all the flashcards

    Constant

    A variable whose value cannot be changed once it has been assigned.

    Signup and view all the flashcards

    Alias

    A reference variable that points to the same object as another reference variable.

    Signup and view all the flashcards

    Static method

    A method that can be called without creating an object of the class.

    Signup and view all the flashcards

    Instance method

    A method that requires an object of the class to be created before it can be called.

    Signup and view all the flashcards

    Static variable

    A variable that is shared by all instances of a class.

    Signup and view all the flashcards

    Postcondition

    A condition that must always be true just after the execution of a code segment.

    Signup and view all the flashcards

    Precondition

    A condition that must always be true just before the execution of a code segment.

    Signup and view all the flashcards

    Study Notes

    Unit 1 - Object-Oriented Programming

    • A software engineer designs, develops, and tests software.
    • A class header includes the class keyword and the class name.
    • Comments explain code but are ignored by the program.
    • Source code is a set of programming commands.
    • Syntax rules dictate how code is written.
    • Syntax errors are mistakes in code.
    • Attributes describe characteristics of an object.
    • Behaviors are actions an object can perform.
    • A class is a blueprint for creating objects.
    • An object is an instance of a class.
    • Object-oriented programming uses models of objects.
    • A constructor creates a new object.
    • The dot operator is used to call methods in a class.
    • A method is a named set of instructions.
    • Arguments are provided to methods.
    • Parameters define expected input values.
    • String literals are enclosed in quotes.
    • An algorithm is a finite set of instructions.
    • Conditions control code execution.
    • Iteration statements repeat code blocks.
    • Inheritance enables subclasses to inherit attributes and behaviors from superclasses.
    • Subclasses extend superclasses.
    • A tester class runs a program.
    • Method signatures include the name and parameter list.
    • The return statement exits a method.
    • A void method doesn't return a value.
    • Code review improves code quality.
    • Commits save code changes.
    • Documentation describes code purpose and functionality.
    • Programming style guides code formatting.
    • Selection statements execute code based on conditions.
    • Data types define data formats.
    • Variable declarations give variables names and types.
    • Variables store values in memory.
    • Decomposition breaks problems into smaller parts.
    • Efficient code uses minimal resources.
    • Pseudocode describes algorithms.
    • Redundant code is unnecessary.
    • Logical operators return Boolean values.

    Unit 2 - Class Structure and Design

    • The DRY principle minimizes code repetition.
    • Access modifiers control visibility.
    • Encapsulation hides internal data.
    • Instance variables represent object attributes.
    • Refactoring improves code structure without changing function.
    • Constructors have a signature.
    • Default values are predefined.
    • No-argument constructors have no parameters.
    • Call by value copies argument values.
    • Local variables are defined within a block.
    • Method overloading allows methods with same names but different signatures.
    • Parameterized constructors accept arguments.
    • An object's state is defined by its instance variables.
    • Variable scope determines where a variable can be used.
    • Assignment gives a value to a variable.
    • Initialization gives initial values.
    • Primative types are basic data types.
    • Reference types hold object memory locations.
    • Accessor methods retrieve object data.
    • Libraries contain reusable components.
    • Application Program Interfaces (APIs) are libraries.
    • Return by value copies the value.
    • Compound assignment operators perform operations and assign results.
    • Compound expressions combine expressions.
    • Concatenation joins strings.
    • Expressions evaluate to a single value.
    • Operands are data elements.
    • Truncation shortens data.
    • Boolean expressions evaluate to true or false.
    • Mutator methods change object data.
    • Relational operators compare values.
    • Escape sequences provide special characters.
    • Override redefines inherited methods.

    Unit 3 - Arrays and Algorithms Vocabulary

    • Data structures organize, process data.
    • Elements are single values in a structure.
    • A one-dimensional array stores single-line data.
    • Indexes specify values' positions in a structure.
    • Initializer lists create arrays by providing values.
    • Traversing accesses elements sequentially.
    • Decrementing decreases a value.
    • Incrementing increases a value.
    • Loop control variables determine loop end.
    • Off-by-one errors occur when loops run one iteration too many or too few.
    • Postconditions define the state after code execution.
    • Preconditions define the state before execution.
    • Instance methods require object creation.
    • Static methods can be used without object creation.
    • Static variables are shared by class instances.
    • Constants have unchanging values.
    • Casting converts types.
    • Widening converts smaller types to larger types.
    • Aliases create multiple names for the same object.
    • Nested conditional statements are conditional statements within conditional statements.
    • Compound Boolean expressions use logical operators.
    • Short-circuited evaluations evaluate expressions until the result is clear.
    • Truth tables determine boolean expression values.
    • De Morgan's laws simplify Boolean expressions.
    • Multi-selection statements choose actions based on conditions.

    Unit 4 - Conditions and Logic Vocabulary

    -(Information repeated, omitting)

    Unit 5 - Two-Dimensional Arrays Vocabulary

    • Column is a vertical array.
    • Inner array is within an array.
    • Outer array holds an array of arrays.
    • Row is an horizontal array.
    • Two-dimensional arrays resemble tables.
    • Row-major order processes by rows.
    • Column-major order processes by columns.
    • RGB is a color model.
    • Pixel is an image's smallest unit.

    Studying That Suits You

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

    Quiz Team

    Related Documents

    Vocab+Chpt+1+-+5 PDF

    Description

    Explore the concepts of Object-Oriented Programming in this quiz covering fundamental principles such as classes, objects, methods, and inheritance. Test your understanding of key terms and their applications in software development. Perfect for beginners looking to enhance their programming knowledge.

    More Like This

    CS-1201 Object Oriented Programming
    9 questions
    Programação Orientada a Objetos
    37 questions
    Software Development - ITATCITO3 - Lecture 6
    30 questions
    Use Quizgecko on...
    Browser
    Browser