1. Which of the following is the most suitable definition of a function in
programming?
A. A function is a block of code that performs a specific task.
B. A function is used to store data.
C. A function is a sequence of statements that produce output.
D. A function is a method for creating variables.
Answer: A
Rationale: A function is a block of code that performs a specific task and can be
reused throughout the program.
2. Which of the following is an example of an integrated development environment
(IDE)?
A. Python
B. Eclipse
C. HTML
D. CSS
,Answer: B
Rationale: Eclipse is a popular IDE used for Java and other programming
languages.
3. Which of the following is a property of an abstract class in Java?
A. It can be instantiated directly
B. It can contain abstract methods
C. It cannot contain any methods
D. It must be final
Answer: B
Rationale: An abstract class in Java can contain abstract methods, which are
methods without implementation.
4. In Java, what does System.out.println() do?
A. Prints data to the console with a newline
B. Writes data to a file
C. Outputs data to a web browser
D. Prints an error message
, Answer: A
Rationale: System.out.println() prints data to the console and moves the cursor to
the next line.
5. Which of the following is a feature of Object-Oriented Programming?
A. Functions
B. Inheritance
C. Loops
D. Arrays
Answer: B
Rationale: Inheritance is one of the key features of OOP, allowing one class to
inherit properties and methods from another.
6. Which of the following is the correct syntax to define a class in Python?
A. class MyClass()
B. class MyClass:
C. class MyClass[]
D. define MyClass
programming?
A. A function is a block of code that performs a specific task.
B. A function is used to store data.
C. A function is a sequence of statements that produce output.
D. A function is a method for creating variables.
Answer: A
Rationale: A function is a block of code that performs a specific task and can be
reused throughout the program.
2. Which of the following is an example of an integrated development environment
(IDE)?
A. Python
B. Eclipse
C. HTML
D. CSS
,Answer: B
Rationale: Eclipse is a popular IDE used for Java and other programming
languages.
3. Which of the following is a property of an abstract class in Java?
A. It can be instantiated directly
B. It can contain abstract methods
C. It cannot contain any methods
D. It must be final
Answer: B
Rationale: An abstract class in Java can contain abstract methods, which are
methods without implementation.
4. In Java, what does System.out.println() do?
A. Prints data to the console with a newline
B. Writes data to a file
C. Outputs data to a web browser
D. Prints an error message
, Answer: A
Rationale: System.out.println() prints data to the console and moves the cursor to
the next line.
5. Which of the following is a feature of Object-Oriented Programming?
A. Functions
B. Inheritance
C. Loops
D. Arrays
Answer: B
Rationale: Inheritance is one of the key features of OOP, allowing one class to
inherit properties and methods from another.
6. Which of the following is the correct syntax to define a class in Python?
A. class MyClass()
B. class MyClass:
C. class MyClass[]
D. define MyClass