1. What is the default value of a variable of type int in Java?
A. 0
B. null
C. 1
D. undefined
Answer: A
Rationale: The default value of an int in Java is 0.
2. What does the __init__ method do in Python classes?
A. Initializes the class
B. Initializes the object
C. Calls another function
D. Returns a value
Answer: B
Rationale: The __init__ method is the constructor in Python, and it is called when
an object is created to initialize its attributes.
,3. Which function is used to read input from the user in Python?
A. input()
B. read()
C. scan()
D. get()
Answer: A
Rationale: The input() function is used in Python to read input from the user.
4. Which of the following is a type of sorting algorithm?
A. Bubble Sort
B. Linked List
C. Hash Map
D. Set
Answer: A
Rationale: Bubble Sort is a well-known sorting algorithm used to order elements in
a list or array.
, 5. What is the function of an API (Application Programming Interface)?
A. It allows software applications to communicate with each other.
B. It stores data for applications.
C. It is used to create graphical interfaces.
D. It compiles programs.
Answer: A
Rationale: An API allows different software applications to communicate with
each other, providing a set of protocols and tools for building software.
6. In Java, what is the default value of a boolean variable?
A. True
B. False
C. Null
D. 0
Answer: B
Rationale: In Java, the default value of a boolean variable is false.
A. 0
B. null
C. 1
D. undefined
Answer: A
Rationale: The default value of an int in Java is 0.
2. What does the __init__ method do in Python classes?
A. Initializes the class
B. Initializes the object
C. Calls another function
D. Returns a value
Answer: B
Rationale: The __init__ method is the constructor in Python, and it is called when
an object is created to initialize its attributes.
,3. Which function is used to read input from the user in Python?
A. input()
B. read()
C. scan()
D. get()
Answer: A
Rationale: The input() function is used in Python to read input from the user.
4. Which of the following is a type of sorting algorithm?
A. Bubble Sort
B. Linked List
C. Hash Map
D. Set
Answer: A
Rationale: Bubble Sort is a well-known sorting algorithm used to order elements in
a list or array.
, 5. What is the function of an API (Application Programming Interface)?
A. It allows software applications to communicate with each other.
B. It stores data for applications.
C. It is used to create graphical interfaces.
D. It compiles programs.
Answer: A
Rationale: An API allows different software applications to communicate with
each other, providing a set of protocols and tools for building software.
6. In Java, what is the default value of a boolean variable?
A. True
B. False
C. Null
D. 0
Answer: B
Rationale: In Java, the default value of a boolean variable is false.