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 term describes real-life entities that possess a definite state and behaviour?
Answer
Objects
Question
What characteristic of an object represents its data or value?
Answer
State
Question
What characteristic of an object represents its operation or working?
Answer
Behaviour
Question
Which object characteristic is used exclusively by the JVM to distinguish one object from another?
Answer
Identity
Question
Why is an object considered an 'instance' of a class?
Answer
It represents one specific entity based on the class's blueprint.
Question
What is the primary difference between a class and an object regarding the number of entities they represent?
Answer
An object represents a single entity, whereas a class represents an entire set of such objects.
Question
The process of showing only essential features while hiding complex, unnecessary details is called _____.
Answer
Abstraction
Question
What term is used for the process of 'data hiding' to protect sensitive information from the user?
Answer
Abstraction
Question
How are certain data limits enforced in Java to implement abstraction and data protection?
Answer
Through the use of access specifiers.
Question
The mechanism of wrapping data and member functions into a single unit is defined as _____.
Answer
Encapsulation
Question
Once a programme is encapsulated, how can the hidden data be accessed?
Answer
Only by the member functions of that specific class.
Question
What is a primary benefit of encapsulation regarding code maintenance?
Answer
It allows the programmer to maintain and change independent packages easily.
Question
A _____ is a blueprint for an object that contains all necessary data for a specific purpose.
Answer
Class
Question
Why is a Java class referred to as a 'factory of objects'?
Answer
It allows for the creation of an unlimited number of objects from one blueprint.
Question
What are the two main components that represent the state and behaviour of an object within a class?
Answer
Data members and member methods.
Question
Which keyword is mandatory when defining a new class in Java?
Answer
class
Question
In a class definition, what name is given to the variables that store data?
Answer
Data members (or instance variables).
Question
What is the collective term for the member variables and member methods located inside a class?
Answer
Body of the class.
Question
Which type of variable is declared only once for a class and shared among all its objects?
Answer
Class variable
Question
What keyword must be used to create a class variable?
Answer
static
Question
Variables created for every individual object of a class are known as _____.
Answer
Instance variables
Question
A _____ is a group of statements designed to perform a specific operation within a class.
Answer
Method
Question
In a method declaration, what does the keyword `void` signify?
Answer
The method does not return any value.
Question
Which part of a method declaration tells the compiler the accessibility of the method?
Answer
The modifier (e.g. public).
Question
The first line of a method's declaration is known as the method _____.
Answer
Prototype
Question
What two elements constitute a 'Method Signature' in Java?
Answer
The method name and the data types of its arguments.
Question
In the method prototype `public static int sum(int a, int b)`, what is the return type?
Answer
int
Question
What general term is used to signify that programme control is moving to execute a specific method construct?
Answer
Calling (or invoking) a method.
Question
Arguments that appear within a method's definition are called _____ parameters.
Answer
Formal
Question
Arguments that appear within a method call are called _____ parameters.
Answer
Actual
Question
Which access specifier allows a member to be accessed all over the programme?
Answer
Public
Question
Which access specifier restricts access to only within the class where the member is defined?
Answer
Private
Question
If no access specifier is explicitly mentioned, which level of access is applied by default?
Answer
Default (accessible only within the same package).
Question
The `protected` access specifier allows access to the same package and to _____ in other packages.
Answer
Subclasses
Question
Why can a single Java file have only one public class?
Answer
The public class name must exactly match the source file name.
Question
What are the three distinct parts of every object declaration?
Answer
Declaration, Instantiation, and Initialisation.
Question
Which Java keyword is used to allocate memory on the heap for a newly created object?
Answer
new
Question
In the statement `add a = new add(10, 20);`, which part represents the object initialisation?
Answer
The call to the constructor `add(10, 20)`.
Question
What syntax is used to reference a specific data member (variable) of an object?
Answer
objectReference.variableName
Question
What syntax is used to invoke a specific method of an object?
Answer
objectReference.methodName(arguments)
Question
Data types that represent a single value like `byte`, `int`, or `char` are known as _____ data types.
Answer
Primitive
Question
How many primitive data types are available in Java?
Answer
8
Question
A variable is a named memory location that can hold a piece of information _____.
Answer
Temporarily
Question
What is the difference between static and dynamic initialisation of a variable?
Answer
Static is a direct value assignment; dynamic results from an expression or method call.
Question
What is a 'Composite Data Type' in Java?
Answer
A type composed of primitive data types that represents a set of values under one name.
Question
Why is a class considered a composite data type?
Answer
It can contain multiple data members of various primitive or reference types.
Question
How is the total memory size of a composite data type determined?
Answer
It is the sum of the sizes of all its individual data members.
Question
Beside classes, what is another example of a composite data type in Java?
Answer
Array
Question
When a primitive data type is passed as a method argument, what does the method receive?
Answer
A copy of the original data.
Question
When a composite data type is passed as a method argument, what does the method receive?
Answer
A reference to the original data.
Question
If a method changes a composite data argument, how does it affect the original object?
Answer
The change will affect the original data because it is passed by reference.
Question
In the variable declaration `float pie = 3.14;`, what is the data type?
Answer
float
Question
Which part of the class contains the code required for the lifecycle of the created objects?
Answer
The class body.
Question
What is the primary purpose of creating methods in a programme?
Answer
To increase code usability and efficiency through modularity.
Question
What term describes the first line of a method that includes its access modifier, return type, and parameters?
Answer
Method Prototype
Question
If a method is defined as `int Poschar(String str1, char ch1)`, what is its Method Signature?
Answer
Poschar(String, char)
Question
Which operator is used to access the members of a class through an object instance?
Answer
The dot (.) operator.
Question
In Java, what occurs during the 'Instantiation' phase of object creation?
Answer
Memory is allocated for the new object on the heap using the `new` keyword.
Question
What is the memory size of the primitive type `int` in Java?
Answer
$4$ bytes
Question
What is the memory size of the primitive type `char` in Java?
Answer
$2$ bytes