AA plan or template from which objects are made. ✓ Correct answer
BA single number stored in memory.
CA command that prints text on the screen.
DA file that stores only pictures.
✓ Correct answer: A plan or template from which objects are made.
Full explanation
A plan or template from which objects are made. In Java, a class is a plan or template from which objects are made, and it defines the data and actions of those objects. Why the others are wrong: A single number stored in memory. — a single number stored in memory is a variable, not a class. A command that prints text on the screen. — a command that prints text on the screen is a print statement, not a class. A file that stores only pictures. — a file that stores only pictures is an image file, not a class.
In Java, which data type is used to store whole numbers?
AString
Bdouble
Cint ✓ Correct answer
Dboolean
✓ Correct answer: int
Full explanation
int. In Java, int is the data type used to store whole numbers such as 5 or 100. Why the others are wrong: String — String is the data type used to store text, not whole numbers. double — double is the data type used to store numbers with a decimal point, not whole numbers. boolean — boolean is the data type used to store true or false, not whole numbers.
In Java, which mark is placed at the end of a simple statement, for example after int age = 20?
AA comma.
BA full stop.
CA semicolon. ✓ Correct answer
DA colon.
✓ Correct answer: A semicolon.
Full explanation
In Java, a simple statement ends with a semicolon. Why the others are wrong: A comma. — A comma separates items in a list, it does not end a statement in Java. A full stop. — A full stop ends a sentence in English, but it does not end a statement in Java. A colon. — A colon is used before a list or a block, it does not end a simple statement in Java. So the correct answer is A semicolon.
In Java, which keyword is used by a class to inherit from another class?
Aimplements
Bextends ✓ Correct answer
Cinherits
Dsuper
✓ Correct answer: extends
Full explanation
extends. In Java, a class uses the keyword extends to inherit the fields and methods of another class. Why the others are wrong: implements — implements is used by a class to follow an interface, not to inherit from a class. inherits — inherits is not a keyword in Java. super — super is used to refer to the parent class, not to declare inheritance.
AA place in memory that stores a value. ✓ Correct answer
BA fixed number that never changes.
CA command that stops a program.
DA picture shown on the screen.
✓ Correct answer: A place in memory that stores a value.
Full explanation
In Java, a variable is a place in memory that stores a value. Why the others are wrong: A fixed number that never changes. — that is a constant, not a variable. A command that stops a program. — that stops a program, but it is not a variable. A picture shown on the screen. — that is an image, not a variable.
ProgrammingJava ProgrammingBPSCID: BPP-2786
In Java, the entry point of a program is the method:
Amain ✓ Correct answer
Brun
Cstart
Dinit
✓ Correct answer: main
Full explanation
In Java, the entry point of a program is the main method.
ProgrammingJava ProgrammingFPSCID: FPP-11404
Which of the following is a feature of object-oriented programming?
AMacros
BInheritance ✓ Correct answer
CPointers only
DGoto statement
✓ Correct answer: Inheritance
Full explanation
Inheritance is a feature of object-oriented programming.
ProgrammingJava ProgrammingPPSCID: LTP-7700
The Java programming language was created by:
AJames Gosling ✓ Correct answer
BGuido van Rossum
CDennis Ritchie
DBjarne Stroustrup
✓ Correct answer: James Gosling
Full explanation
Java was created by James Gosling at Sun Microsystems and first released in 1995.
ProgrammingJava ProgrammingPPSCID: LTP-7701
In Java, the JVM is responsible for:
APrinting documents
BExecuting Java bytecode ✓ Correct answer
CDesigning web pages
DStoring passwords
✓ Correct answer: Executing Java bytecode
Full explanation
The JVM is responsible for executing Java bytecode, running the compiled program on whatever platform it is installed on.
ProgrammingJava ProgrammingPPSCID: LTP-7702
Java is famous for the principle known as:
AWrite once, print anywhere
BRun once, forget it
CWrite once, run anywhere ✓ Correct answer
DCompile once, delete it
✓ Correct answer: Write once, run anywhere
Full explanation
Java follows write once, run anywhere, because compiled bytecode runs on any machine with a JVM.
ProgrammingJava ProgrammingPPSCID: LTP-7703
In Java, which access modifier makes a member visible only inside its own class?
Apublic
Bprotected
Cstatic
Dprivate ✓ Correct answer
✓ Correct answer: private
Full explanation
In Java the private access modifier makes a member visible only inside its own class, hiding it from other classes.
ProgrammingJava ProgrammingPPSCID: LTP-7704
In Java, inheritance between classes is created with which keyword?
Aextends ✓ Correct answer
Binherits
Cimplements
Dderives
✓ Correct answer: extends
Full explanation
In Java the extends keyword creates inheritance, letting a class inherit the fields and methods of another class.
ProgrammingJava ProgrammingPPSCID: LTP-7705
In a Java program, execution begins in which method?
Astart
Bmain ✓ Correct answer
Cinit
Drun
✓ Correct answer: main
Full explanation
Execution of a Java program begins in the main method, the entry point of the program.
ProgrammingJava ProgrammingPPSCID: LTP-7706
Which of the following is the correct signature of the main method in Java?