Programming MCQs January 8, 2026August 9, 2024 by u930973931_answers 10 min Score: 0 Attempted: 0/10 Subscribe 1. Which of the following is the correct syntax for defining a function in Python? (A) def name(): (B) function name() {} (C) func name[] {} (D) define name() {} 2. In which programming language is System.out.println() used? (A) Python (B) JavaScript (C) C++ (D) Java 3. What is the output of print(“Hello” + ” World”) in Python? (A) Hello World (B) HelloWorld (C) Hello + World (D) Hello World 4. Which of the following is not a valid data type in Python? (A) char (B) string (C) boolean (D) int 5. What does the following Python code do? list(range(5)) (A) Creates a list of integers from 1 to 5 (B) Creates a list of integers from 0 to 5 (C) Creates a list of integers from 1 to 4 (D) Creates a list of integers from 0 to 4 6. What is the output of 2**3 in Python? (A) 6 (B) 9 (C) 8 (D) 16 7. How do you declare a variable in JavaScript? (A) variable name = value; (B) var name = value; (C) let name := value; (D) define name = value; 8. What is the correct way to comment a single line in C++? (A) # comment (B) // comment (C) β comment (D) /* comment */ 9. In which language is for loop syntax for (int i = 0; i < 10; i++) used? (A) C++ (B) Python (C) JavaScript (D) Java 10. What will be the output of print(0.1 + 0.2 == 0.3) in Python? (A) False (B) True (C) None (D) Error