Unit 2: Using Objects Flashcards

1
Q

abs(int a)

A

A function used to find and return the absolute value (magnitude) of an integer. It disregards any negative sign attached to it and always gives back its positive equivalent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
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
3
Q

Assignment operator

A

Used to assign a value to a variable. It is represented by the equals sign (=) and it assigns the value on the right side of the equals sign to the variable on the left side.

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

Classes

A

User-defined data types in object-oriented programming. They serve as blueprints for creating objects by defining their attributes and methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
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
6
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
7
Q

IllegalArgumentException

A

An exception that occurs when a method receives an argument that is inappropriate or invalid for its intended purpose. It usually indicates that there was an error in how arguments were passed into a method.

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

indexOf(String str)

A

A method used to find the index position of the first occurrence of a specified substring within a larger string.

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

Inheritance

A

A concept in object-oriented programming where a class inherits the properties and behaviors of another class. It allows for code reuse and promotes the creation of hierarchical relationships between classes.

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

Return type (void)

A

In programming refers to the data type of the value that a method or function returns. In the case of “void,” it means that the method does not return any value.

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

length()

A

A method used to find the number of characters in a string.

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

Math class

A

A class in Java that provides various mathematical operations and functions that can be performed on numeric data types. It includes methods for basic arithmetic operations, trigonometry, logarithms, random numbers generation, etc.

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

Math.PI

A

A constant in the Math object of JavaScript that represents the ratio of the circumference of a circle to its diameter. It is approximately equal to 3.14159.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
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
15
Q

Null keyword

A

A special value in programming that represents the absence of a value. It is often used to indicate that a variable does not currently have any assigned value.

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

Object-oriented programming (OOP)

A

A programming paradigm that organizes code into objects, which are instances of classes. It emphasizes the use of objects to represent real-world entities and their interactions.

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

Objects

A

Instances of a class that represent real-world entities or concepts. They encapsulate data (attributes) and behavior (methods) into a single entity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
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
19
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.

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

Polymorphism

A

Refers to the ability of objects to take on multiple forms or have multiple types. In programming, it allows different objects to be treated as instances of a common superclass, enabling flexibility and extensibility.

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

pow(double a, double b)

A

A function that is used to raise a number (a) to the power of another number (b). It returns the result of a raised to the power of b.

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

Primitive data types

A

Basic data types that are built into a programming language and represent simple values. They include integers, floating-point numbers, characters, booleans, and more.

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

random()

A

A function that generates and returns a pseudo-random decimal value between 0.0 (inclusive) and 1.0 (exclusive).

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

Reference types

A

Data types in programming that store references or memory addresses rather than the actual values themselves. They include objects, arrays, and strings, and allow for dynamic memory allocation and manipulation.

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

sqrt(double a)

A

A function that calculates and returns the square root of a given number (a).

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

substring(int beginIndex, int endIndex)

A

A method that is used to extract a portion of a string based on the specified beginning and ending indexes. It returns a new string that contains the characters from the original string within the given range.

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

substring(int beginIndex)

A

A method that is used to extract part of an existing string starting from the specified beginning index up to (but not including) the end of the original string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
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
29
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
30
Q

Object-Oriented Programming

A

A programming paradigm that organizes code into objects, which are instances of classes. It focuses on creating reusable and modular code by encapsulating data and behavior together.

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

Reference Type

A

A data type that stores the memory address of an object rather than the actual value. It allows multiple variables to refer to the same object, and changes made to one variable will affect all other variables referencing that object.

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

System.out.println

A

A Java statement used to display output on the console. It prints the specified message or value and adds a new line character at the end.

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

Constructor Overloading

A

A feature in OOP that allows multiple constructors with different parameter lists within a single class. Each constructor can initialize an object with different sets of values.

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

Object

A

An instance of a class that encapsulates data and behavior. It represents a real-world entity or concept in the program.

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

New Keyword

A

Used in Java to create an instance (object) of a class. It allocates memory for the object and initializes its attributes using the constructor method.

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

NullPointerException

A

Occurs when a program tries to access or use an object that has not been initialized, meaning it is currently set to “null”.

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

Parameter List

A

A set of input parameters/arguments that are passed to a method or constructor when it is called. It specifies the type and order of the values that need to be provided for the method/constructor to execute correctly.

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

Pass-by-value language

A

Refers to programming languages where copies of variable values are passed into functions. Any changes made to these copies do not affect the original variables.

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

Primitive value

A

A basic data type in programming that represents simple pieces of information such as numbers or characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
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.

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

Non-Static Methods

A

Functions or procedures that belong to an object and can only be accessed through an instance of the class. They can modify the state of an object and are not associated with a specific class.

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

CalculateArea

A

Refers to the process of determining the size or extent of an enclosed shape or region using mathematical formulas or algorithms. It is commonly used in programming when working with geometric shapes.

43
Q

calculateAverage

A

Refers to the process of finding the mean value of a set of numbers by adding them up and dividing by the total count.

44
Q

calculateDiscount

A

Determining how much money can be saved from an original price by applying a percentage reduction.

45
Q

calculateSum

A

An operation that involves adding up multiple numbers together to obtain their total sum.

46
Q

Constructor Signature

A

Refers to the unique combination of a class’s name and its parameter types. It helps create instances (objects) of that class with specific initial values.

47
Q

Method Signature

A

Refers to the unique combination of a method’s name and its parameter types. It helps distinguish one method from another.

48
Q

Outputs

A

Refer to the results or values that are produced by a program or function when it is executed.

49
Q

Overloading Methods

A

Refers to defining multiple methods with the same name but different parameters in a class. This allows for flexibility and reusability by providing different ways to perform similar tasks.

50
Q

printArea

A

Refers to a function or method that outputs the calculated area of a shape onto a physical medium, such as paper or a computer screen.

51
Q

printAverage

A

Refers to displaying or outputting the calculated average value on a screen or paper.

52
Q

printSum

A

Refers to an action where the computed sum of multiple numbers is displayed on some physical medium for viewing purposes.

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

Boolean Expressions

A

Statements that evaluate to either true or false. They are commonly used in programming to make decisions and control the flow of a program.

55
Q

calculateCircleArea(double radius)

A

A method used to compute the area of a circle based on its radius. It takes in the radius as input and returns the calculated area.

56
Q

calculateRectangleArea(double length, double width)

A

A method used to calculate the area of a rectangle based on its length and width. It takes in the length and width as input parameters and returns the calculated area.

57
Q

calculateTriangleArea(int base, double height)

A

A function that calculates the area of a triangle using its base length and height.

58
Q

Class Definition

A

A blueprint or template for creating objects of a particular type. It defines the properties and behaviors that an object of that class will have.

59
Q

Data Type

A

A classification that specifies the type of value that a variable can hold. It determines the operations that can be performed on the variable, such as arithmetic operations or string manipulation.

60
Q

eat()

A

A method that is a function that allows an object to consume food or perform actions related to consuming food.

61
Q

getIsPremium()

A

A method that is used to check if a user has a premium account or not. It returns true if the user is a premium member, and false otherwise.

62
Q

getSpeed()

A

A method that is used to retrieve the value of the speed attribute in a program. It returns the current speed of an object or entity.

63
Q

giveRaise(int raiseAmount)

A

Refers to a function or method that increases an employee’s salary by a specified amount.

64
Q

isCondition()

A

A method that is used in programming to check if a certain condition is true or false. It returns a boolean value, either true or false, based on the evaluation of the condition.

65
Q

isValidEmail(String email)

A

This method checks whether a given email address is valid or not.

66
Q

methodName(parameterListOptional)

A

An identifier that represents an action or behavior that an object can perform. It may also include optional parameters, which are values passed into the method for it to use during its execution.

67
Q

Primitive Data

A

Refers to basic data types that are built into a programming language, such as integers, floating-point numbers, characters, and booleans. These data types are not composed of other data types.

68
Q

printBookInfo()

A

Refers to a method or function that displays information about a book, such as its title, author, and publication date.

69
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.

70
Q

Reference Data

A

Refers to complex data types that are composed of multiple primitive or reference data types. Examples include arrays, objects, and strings. Unlike primitive data types, reference variables store references (memory addresses) rather than actual values.

71
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.

72
Q

reverseString(String str)

A

A string as input and returns the reversed version of that string.

73
Q

Static

A

In programming, “static” 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.

74
Q

sumNumbers(int num1, int num2, int num3)

A

This term refers to a function or method that adds together three numbers and returns their sum.

75
Q

variableName

A

A unique identifier that is used to store and refer to a value in a program. It must follow certain rules, such as starting with a letter or underscore, and cannot be a reserved keyword.

76
Q

NAME?

A

An arithmetic operator commonly used for addition. However, it also serves as the concatenation operator for combining strings together.

77
Q

Escape characters

A

Special characters that are used to represent certain actions or non-printable characters within a string. They are preceded by a backslash () and allow you to include characters like quotes, newlines, or tabs in your strings.

78
Q

main method

A

The entry point of any Java program. It acts as the starting point for execution when you run your code, and it must be present in every Java program.

79
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.

80
Q

String class

A

A built-in class in Java that represents a sequence of characters. It provides various methods to manipulate and work with strings.

81
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.

82
Q

substring()

A

A method in Java that is used to extract a portion of a string based on specified starting and ending indexes. It returns a new string containing the extracted characters.

83
Q

System.out.println()

A

A method in Java that allows you to display output on the console. It takes an argument (a value or a variable) and prints it as text.

84
Q

toLowerCase()

A

A method in Java that converts all uppercase characters in a string to lowercase. It returns a new string with the converted characters.

85
Q

toUpperCase()

A

A method that is a built-in function in Java that converts all the characters in a string to uppercase letters.

86
Q

compareTo(String other)

A

A method that is used to compare two strings lexicographically. It returns an integer value that indicates the relationship between the two strings.

87
Q

External Libraries

A

Pre-written code that can be imported into a program to provide additional functionality. They contain a collection of classes and methods that can be used to perform specific tasks without having to write the code from scratch.

88
Q

indexOf(String str)

A

A method that is used to find the index position of the first occurrence of a specified substring within a larger string.

89
Q

length() method

A

A built-in function in Java that returns the number of characters in a string.

90
Q

Overloaded Methods

A

Multiple methods in a class with the same name but different parameters. They allow you to perform similar operations on different types of data.

91
Q

Substring

A

Refers to extracting a smaller part of a larger string by specifying its starting and ending positions.

92
Q

Zero-indexed language

A

In computer programming, refers to systems where counting starts from 0 instead of 1 when accessing elements in an ordered collection (e.g., arrays).

93
Q

Autoboxing

A

The automatic conversion of a primitive data type to its corresponding wrapper class object. For example, when an int is assigned to an Integer object, autoboxing occurs.

94
Q

Integer class

A

A built-in class in Java that represents integer values. It provides methods to perform various operations on integers, such as converting them to strings or performing arithmetic calculations.

95
Q

Reference Data Type

A

A data type that refers to an object in memory rather than directly storing the value. It stores the memory address where the object is located.

96
Q

Unboxing

A

The automatic conversion of a wrapper class object to its corresponding primitive data type. For example, when an Integer object is assigned to an int variable, unboxing occurs.

97
Q

Double

A

In Java, it is both a wrapper class for primitive type double and also represents real numbers with decimal points. It provides useful methods for performing mathematical operations on these numbers.

98
Q

Exponents

A

A way to represent repeated multiplication of a number by itself. For example, 2^3 means multiplying 2 by itself three times (2 x 2 x 2 = 8).

99
Q

Integer

A

A data type in programming that represents whole numbers without any decimal or fractional parts.

100
Q

Math.abs(number)

A

A function that returns the absolute value of a number, which is the positive value of the number regardless of its original sign.

101
Q

Math.random()

A

A method in Java that generates a random decimal number between 0 (inclusive) and 1 (exclusive). It is commonly used to generate random numbers in programming.

102
Q

Scanner

A

A class in Java that allows the user to read input from various sources, such as the keyboard or a file.

103
Q

String

A

A sequence of characters in Java, enclosed in double quotes. It represents text and can be manipulated using various methods.