Study Materials Available

Access summaries, videos, slides, infographics, mind maps and more

View Materials
Quick Review Flashcards - Click to flip and test your knowledge!
Question
In Object-Oriented Programming, what element is emphasised over procedures and structures?
Answer
Data
Question
What term describes the building blocks of an OOP programme that contain both data and methods?
Answer
Objects
Question
How are methods and data related in an object-oriented approach?
Answer
Methods that operate on an object's data are tied together with that data.
Question
Concept: Object
Answer
Definition: An identifiable entity with its own characteristics and behaviour.
Question
What is the software representation of an object's 'characteristics'?
Answer
Data variables or fields
Question
In software, what determine the current 'state' of an object?
Answer
The values stored in its data variables.
Question
What software component acts as the interface between an object's data and the rest of the programme?
Answer
Methods
Question
Concept: Class
Answer
Definition: A blueprint or factory from which individual objects or instances are created.
Question
Which Java keyword is used to define a new class?
Answer
`class`
Question
Why is a class referred to as a 'User Defined Data Type'?
Answer
Because the programmer creates a new type with its own state and behaviour.
Question
In the context of message passing, what is a 'message' physically represented by in software?
Answer
A method call
Question
What are the three components of a message sent between objects?
Answer
The name of the method, the receiving object, and any necessary parameters.
Question
The process of wrapping data and member functions into a single unit is known as _____.
Answer
Data Encapsulation
Question
What is the primary purpose of 'Data Hiding' in encapsulation?
Answer
To protect data from direct access by external methods or the programme.
Question
Concept: Data Abstraction
Answer
Definition: Representing essential features without including background details or explanations.
Question
Classes are sometimes referred to as ADTs; what does this acronym stand for?
Answer
Abstract Data Types
Question
Concept: Inheritance
Answer
Definition: The process by which objects of one class acquire the properties of objects of another class.
Question
In inheritance, what is the term for the uppermost class that provides common properties to others?
Answer
Base class
Question
In inheritance, what are the classes that acquire properties from a base class called?
Answer
Derived classes
Question
What is the main facility provided by inheritance to improve software development efficiency?
Answer
Reusability
Question
Concept: Polymorphism
Answer
Definition: The ability of a function or method to take more than one form or exhibit different behaviours.
Question
What is 'method overloading'?
Answer
When methods with the same name in the same class behave differently based on their parameters.
Question
What is the smallest individual element of a Java programme that is meaningful to the compiler?
Answer
A token
Question
Name the six types of tokens supported by Java.
Answer
Keywords, Identifiers, Literals, Operators, Punctuators, and Variables.
Question
Which specific case must all Java keywords be written in?
Answer
Lowercase
Question
Java identifiers can consist of alphabets, numbers, and which two special characters?
Answer
Underscore `_` and Dollar sign `$`
Question
What is the restriction regarding the first character of a Java identifier?
Answer
It must begin with an alphabet, an underscore, or a dollar sign (not a digit).
Question
Why is 'Sum' and 'sum' considered different in Java identifiers?
Answer
Because Java is a case-sensitive language.
Question
Concept: Variable
Answer
Definition: A named location in memory that stores a value which can change during programme execution.
Question
A program element whose value remains unchanged during the course of the programme is called a _____.
Answer
Constant (or Literal)
Question
Which Java keyword is used to declare a variable as a constant?
Answer
`final`
Question
How are Java operators classified based on the number of operands they take?
Answer
Unary, binary, and ternary
Question
What is the purpose of a data type in Java?
Answer
It dictates the memory size, range of values, and default value for a variable.
Question
Name the two major categories of data types in Java.
Answer
Primitive Data Types and Reference Data Types.
Question
List the eight primitive data types supported by Java.
Answer
byte, short, int, long, float, double, char, and boolean.
Question
Which primitive data types are classified as 'floating point types'?
Answer
float and double
Question
What is the storage capacity of the `int` data type?
Answer
4 bytes ($32$ bits)
Question
What is the default value for the `long` data type?
Answer
$0L$
Question
What suffix is used to explicitly represent a `double` literal?
Answer
$d$ or $D$
Question
What is the range of values for the `byte` data type?
Answer
$-128$ to $127$
Question
How many bits of storage does the `char` data type use in Java?
Answer
16 bits ($2$ bytes)
Question
What is the default value of the `char` data type in Unicode?
Answer
"\u0000"
Question
What is the storage size of a `boolean` data type?
Answer
$1$ bit
Question
Why are reference data types also called 'derived data types'?
Answer
Because they are composed of primitive data types.
Question
Concept: Array
Answer
Definition: A named set of elements of similar type stored in contiguous memory locations.
Question
In an array, what are the individual elements referred to by to show their position?
Answer
Subscripts or indices
Question
Which operator is used to allocate memory for a new array or object in Java?
Answer
`new`
Question
What is the purpose of the dot (`.`) operator in Java?
Answer
To access or call member methods or variables of a class through an object.
Question
What package must be imported to use the `Scanner` class for input?
Answer
`java.util`
Question
In Java I/O, what does `System.in` represent?
Answer
The standard input stream, typically linked to the keyboard.
Question
Which `Scanner` method is used to input a single integer?
Answer
`nextInt()`
Question
Which `Scanner` method is used to input a decimal value of type `double`?
Answer
`nextDouble()`
Question
What does the `Math.sqrt(x)` function return?
Answer
The square root of $x$, provided $x$ is a positive number.
Question
What is the return type of the `Math.random()` function?
Answer
A `double` value between $0$ and $1$.
Question
Concept: `Math.ceil(x)`
Answer
Definition: Returns the smallest whole number greater than or equal to $x$.
Question
What is the result of `Math.pow(2, 3)`?
Answer
$8.0$
Question
Which control structures execute statements based on a boolean condition?
Answer
Conditional Control Structures (e.g., `if-else`, `switch`)
Question
What happens if a single statement follows an `if` condition without curly braces?
Answer
Only that single statement is treated as part of the `if` block.
Question
What is the term for an `if` statement written inside another `if` statement?
Answer
Nesting (Nested `if` statement)
Question
In a `switch` statement, what happens if a `break` statement is omitted after a `case` block?
Answer
Control flows into the next `case` block automatically (fall-through).