Unit 5: Writing Classes Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Class

A

A blueprint or template for creating objects in object-oriented programming. It defines the properties and behaviors that an object of that class will have.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Global Scope

A

Refers to the area outside of any blocks or functions where variables are defined. Variables declared in the global scope can be accessed from anywhere in the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Instance Variable

A

A variable that belongs to an object and holds unique data for each instance of the class. It is declared within a class but outside any method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Local Scope

A

An area within a specific block or function where variables are defined and accessible. Variables declared inside this local scope cannot be accessed outside of it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Methods

A

Functions defined within a class that perform specific tasks or actions when called upon by an object. They can manipulate data, interact with other objects, or return values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Mutator Methods (Setters)

A

Methods in object-oriented programming that allow the modification of an object’s attributes or properties. They provide a way to update the values of private instance variables within a class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Object

A

An instance of a class that represents a specific entity or thing in a program. It contains both data (attributes) and behavior (methods).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Private

A

In the context of programming, refers to a visibility modifier that restricts access to certain variables or methods within a class. It means that only other members of the same class can access those private elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

public

A

An access modifier in Java that indicates unrestricted visibility for classes, methods, and variables. Public members can be accessed from any other class or package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Scope

A

Refers to the visibility and accessibility of variables, functions, and objects within a program. It determines where in the code these entities can be accessed and used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Static Methods

A

Methods that belong to the class itself, rather than an instance of the class. They can be called directly using the class name without creating an object of the class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Static Variables

A

Variables that belong to the class itself, rather than an instance of the class. They are shared by all instances of the class and can be accessed without creating an object of the class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

this keyword

A

Refers to the current object within an instance method or constructor. It can be used to refer explicitly to instance variables or invoke other constructors within the same class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Variables

A

Named storage locations in computer memory that hold values which can be changed during program execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Abstraction

A

The process of simplifying complex systems by focusing on essential features while hiding unnecessary details. It allows programmers to work with high-level concepts without worrying about implementation specifics.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Behaviors

A

Refer to the actions or operations that an object can perform. They are defined as methods within a class and allow objects to interact with each other and manipulate data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Default Constructor

A

A special type of constructor that is automatically created by the compiler if no other constructors are defined in a class. It initializes the object’s instance variables with default values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Encapsulation

A

Refers to the bundling of data and methods within a class, where the data is hidden from external access. It ensures that an object’s internal state remains consistent by controlling how it can be accessed or modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Get Method (Accessor)

A

A method used to retrieve the value of an object’s private instance variable. It provides read-only access to the data stored in the object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Instance Variables

A

Variables declared within a class but outside any method. They hold unique values for each instance (object) of the class and define the state or characteristics of an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Overloading constructors

A

Refers to the ability to have multiple constructors in a class, each with a different set of parameters. This allows objects to be created with different initial states or configurations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Parameterized Constructor

A

A special type of constructor that allows you to pass arguments when creating an object. It initializes the object’s instance variables with specific values based on those arguments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Set Method (Mutator)

A

A method in object-oriented programming that allows the modification of an object’s attributes or properties. It is used to update the values of instance variables within an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Assignment

A

The act of giving a value to a variable in programming. It involves storing information into memory locations so it can be accessed and manipulated later.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Constructor

A

A special method within a class that is used to initialize objects of that class. It is called automatically when an object is created and helps set initial values for its attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

String

A

A sequence of characters, such as letters, numbers, and symbols, that is used to represent text in programming. It is often enclosed in quotation marks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Mutable Object

A

An object whose state can be modified after it is created. In other words, you can change the values of its attributes or properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Object’s State

A

Refers to the set of values stored in its instance variables at any given time during program execution. It represents the current condition or snapshot of an object’s data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Student

A

An individual who is enrolled in a school or educational institution and is actively pursuing knowledge and education.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Postconditions

A

Conditions or requirements that must hold true after a certain action or function has been executed. They define what should be expected as a result of running the code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Preconditions

A

Conditions or requirements that must be met before a certain action or function can be executed. They ensure that the necessary conditions are in place for the code to run correctly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Throw Statements

A

Used in Java to manually throw an exception. They allow you to create and throw your own custom exceptions or propagate existing ones.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Try-Catch

A

A programming construct used to handle exceptions or errors that may occur during runtime. The code within the “try” block is executed, and if an exception occurs, it is caught and handled in the “catch” block.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

@Override

A

Annotation used in Java to indicate that a method in a subclass is intended to override a method with the same name in its superclass. It helps ensure that the method signature and return type are correct.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

Accessor Methods

A

A type of method in object-oriented programming that allows the retrieval of the value of an object’s private data member. They provide read-only access to the internal state of an object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

Assignment Class

A

Refers to a class used to store values assigned to variables. It is commonly used in programming to hold and manipulate data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Assignment constructor

A

A special type of constructor in object-oriented programming that initializes an object’s instance variables with values provided by the user at the time of object creation.

38
Q

correctAnswer

A

Refers to the accurate response to a question or problem in a given context.

39
Q

name

A

The name refers to a unique identifier given to an entity, such as a variable or a method, in a programming language. It helps distinguish one entity from another.

40
Q

Non-void methods

A

Functions in programming that return a value after performing a specific task or calculation.

41
Q

Private Variables

A

Variables that can only be accessed and modified within the same class they are declared in. They provide encapsulation and help maintain data integrity by preventing direct access from other classes.

42
Q

Return Statement

A

Used in functions/methods to specify what value should be sent back as output when the function is called. It terminates the execution of a function and returns control back to where it was called from.

43
Q

Return Type

A

In programming refers to the data type of the value that a method or function will return when it is called. It specifies what kind of data will be returned by the method.

44
Q

String Concatenation

A

The process of combining two or more strings together into one longer string. It is achieved using the “+” operator in most programming languages.

45
Q

Student class

A

A blueprint or template that defines the properties and behaviors of a student object. It specifies what data (such as name, grade level) and methods (such as calculateGPA()) a student object can have.

46
Q

Student constructor

A

A specific type of constructor used to create objects representing students. It initializes instance variables related to student attributes such as name, age, grade level, etc., when creating new student objects.

47
Q

Immutable

A

Refers to an object or data structure that cannot be changed after it is created. Once created, its state remains constant throughout its lifetime.

48
Q

Mutator Methods

A

Special types of methods in object-oriented programming that allow modification or mutation of an object’s attributes or properties.

49
Q

setGradeLevel method

A

A function or method used in programming to update or change the grade level attribute or property of an object. It allows you to modify the grade level associated with a particular object.

50
Q

setName method

A

Typically used in programming to set or change the name attribute or property of an object. It allows you to update or modify the name associated with an object.

51
Q

Setter Methods

A

A type of method in object-oriented programming that allows the modification or update of the values of instance variables within an object.

52
Q

toString method

A

A built-in method in Java that converts an object into a string representation. It returns a string that represents the value of the object.

53
Q

Void Methods

A

Methods in programming that do not return a value. They perform a specific task or action, but they do not produce any output.

54
Q

access modifier

A

Used in programming languages to control the visibility and accessibility of variables, methods, and classes within different parts of code. It determines whether other parts of code can access and modify certain elements.

55
Q

boolean

A

A data type that can only have two possible values - true or false. It is often used in programming to make decisions and control the flow of a program.

56
Q

getGradeDecimal()

A

A method or function used in programming to retrieve the numerical value of a student’s grade. It returns the grade as a decimal number.

57
Q

int

A

A primitive data type in Java used to store whole numbers without decimal points. It has a fixed size and represents integer values within a specific range.

58
Q

Javadoc comments

A

Special comments in Java that begin with /** and end with */. They are used to generate documentation for classes, methods, and fields, making it easier for other developers (including yourself) to understand how to use them.

59
Q

Pass-by-value

A

The method of passing arguments to functions or methods by creating copies of their values instead of directly passing references to them.

60
Q

protected

A

In programming, this is an access modifier that grants accessibility to members within subclasses or classes within the same package.

61
Q

public class

A

A class that can be accessed and used by any other class or program. It serves as the blueprint for creating objects and contains variables and methods.

62
Q

returnCurrentAssignment()

A

This term refers to a method in programming that retrieves the current assignment. It is used to access and display the details of the assignment that is currently being worked on.

63
Q

setGradeLevel()

A

In programming, a method used to assign or update the grade level of an individual. It allows you to specify which grade level someone belongs to within your program.

64
Q

setName()

A

A function or method used in programming to assign or change the name associated with an object or variable. It allows you to update or set a new name for an entity within your program.

65
Q

Static

A

In programming, this refers to a variable or method that belongs to the class itself, rather than an instance of the class. It can be accessed without creating an object of the class.

66
Q

submitAssignment()

A

Refers to a method or function in programming that allows a user to send their completed work or task for evaluation or processing.

67
Q

toString()

A

Used to convert an object into a string representation. It returns a string that represents the state of the object.

68
Q

boolean data type

A

Data type in Java represents one of two possible values - true or false. It is commonly used for conditions and decision-making in programming.

69
Q

Final Keyword

A

Used in Java to declare constants, make methods unchangeable (cannot be overridden), and prevent inheritance (a final class cannot be extended). Once assigned or declared as final, their values or definitions cannot be changed.

70
Q

getGradeDecimal Method

A

A function that retrieves the grade for an assignment as a decimal value. It allows users to access and use grades numerically in calculations or comparisons.

71
Q

getGradeLevel method

A

A function in programming that retrieves the grade level of a student. It returns the grade level as an output.

72
Q

gradeAssignment method

A

A function in programming that calculates and assigns a grade to a student’s assignment based on certain criteria.

73
Q

Keyword “static”

A

Used in Java to declare members (variables or methods) that belong to the entire class rather than any specific instance of the class.

74
Q

Private Access Modifier

A

Used in object-oriented programming to restrict the visibility of a variable or method within a class. It means that the variable or method can only be accessed and modified from within the same class.

75
Q

Public Access Modifier

A

Used in object-oriented programming to allow unrestricted visibility of a variable or method. It means that the variable or method can be accessed and modified from anywhere, including outside the class.

76
Q

submitAssignment method

A

A function that allows students to turn in their completed assignments for grading. It typically takes the submitted content as input and updates the status of the assignment.

77
Q

This Reference

A

Used in Java to refer to the current object on which a method is being called. It can be used to access instance variables, call other methods, or pass the current object as an argument.

78
Q

Method

A

A named sequence of instructions that can be called or invoked to perform a specific task or action. Methods are used for code reusability, organization, and abstraction.

79
Q

Non-Static Method

A

A method that belongs to an instance of a class and can only be accessed through an object. It operates on the specific data of that object.

80
Q

Parameters

A

Variables declared in a method or function that receive values when the method is called. They allow data to be passed into a method, enabling it to perform actions or calculations based on those values.

81
Q

Private Access

A

Refers to the level of accessibility that restricts a class member from being accessed outside of its own class. It is only accessible within the same class.

82
Q

Public Access

A

Refers to the visibility and accessibility of a class, method, or variable within a program. When something is declared as public, it can be accessed from anywhere in the program.

83
Q

getLetterGrade method

A

A function in programming that takes a numerical grade as input and returns the corresponding letter grade. It is commonly used to convert numeric grades into letter grades for reporting purposes.

84
Q

if statement

A

A programming construct that allows the execution of a block of code only if a certain condition is true.

85
Q

Method Call

A

Refers to invoking or executing a method in your code. It involves using the method name followed by parentheses and any required arguments inside the parentheses.

86
Q

Mutator

A

A method in a class that modifies the value of an instance variable. It allows us to change the state of an object after it has been created.

87
Q

newAssignment method

A

A function that creates a new assignment object with specified parameters. It is used to add assignments to a program or system.

88
Q

Overload Constructors

A

Refer to having multiple constructors in a class with different parameters. Each constructor can have a unique set of parameters, allowing for flexibility when creating objects.

89
Q

private modifier

A

An access modifier in object-oriented programming languages that restricts access to members (variables and methods) within a class. Private members can only be accessed from within the same class they are declared in.

90
Q

returnCurrentAssignment method

A

A function in programming that retrieves the current assignment for a student. It allows the program to access and display the assignment details.

91
Q

static final modifier

A

Used to declare constants in programming. It indicates that a variable or method belongs to the class itself, rather than an instance of the class, and its value cannot be changed once assigned.

92
Q

Algorithm

A

Step-by-step procedures or instructions designed to solve specific problems or perform specific tasks.