1. 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.
2. Which of the following is not a valid data structure in Python?
A. List
B. Dictionary
C. Set
D. Tuple
E. Array
Answer: E
,Rationale: Python does not have an Array data type, though you can use lists which
are similar to arrays in other languages.
3. Which method can be used to add an element to the end of a list in Python?
A. add()
B. insert()
C. append()
D. extend()
Answer: C
Rationale: The append() method adds an element to the end of the list.
4. In JavaScript, which of the following is used to define a function?
A. def functionName() {}
B. function functionName() {}
C. func functionName() {}
D. declare functionName() {}
Answer: B
Rationale: The function keyword is used to define a function in JavaScript.
, 5. 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.
6. What does the break statement do in a loop in programming?
A. Terminates the loop and the program
B. Skips the current iteration of the loop
C. Terminates the loop and transfers control to the statement after the loop
D. Starts a new loop
Answer: C
A. True
B. False
C. Null
D. 0
Answer: B
Rationale: In Java, the default value of a boolean variable is false.
2. Which of the following is not a valid data structure in Python?
A. List
B. Dictionary
C. Set
D. Tuple
E. Array
Answer: E
,Rationale: Python does not have an Array data type, though you can use lists which
are similar to arrays in other languages.
3. Which method can be used to add an element to the end of a list in Python?
A. add()
B. insert()
C. append()
D. extend()
Answer: C
Rationale: The append() method adds an element to the end of the list.
4. In JavaScript, which of the following is used to define a function?
A. def functionName() {}
B. function functionName() {}
C. func functionName() {}
D. declare functionName() {}
Answer: B
Rationale: The function keyword is used to define a function in JavaScript.
, 5. 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.
6. What does the break statement do in a loop in programming?
A. Terminates the loop and the program
B. Skips the current iteration of the loop
C. Terminates the loop and transfers control to the statement after the loop
D. Starts a new loop
Answer: C