1- A while loop works like a repeated if statement. (a) True (b) False 2- We can use the upper() function to capitalize only the first letter in the word ‘python’. (a) True (b) False 3- A function is a piece of reusable code. (a) True (b) False 4- The syntax of a multiline comment in Python is ‘’’ ‘’’ or “”” “””. (a) True (b) False 5- Python is an interpreted language as it doesn’t need to be compiled or built. (a) True (b) False 6- if, else, and elif are from the Python attributes. (a) True (b) False 7- We should use an escape character to insert a single quoted string inside a double quoted string. (a) True (b) False 8- Variables defined in a function are local to that function, unless bound by the global keyword. (a) True (b) False 9- The condition var1 <= var2 <= var3 is allowed in Python. (a) True (b) False 10- A Python while can implement a definite loop. (a) True (b) False 11- The if statement can only accept a Boolean expression as a condition. (a) True (b) False 12- sqrt() is a built-in Python function used to calculate the square root of a certain value. (a) True (b) False 13- The output of this code: y = (4-5)**(0.5) print(y) is an error. (a) True (b) False 14- In a mixed-type expression involving ints and floats, Python will convert ints to floats. (a) True (b) False 15- The best structure for implementing a multi-way decision in Python is ………….. (a) if-else (b) while-break (c) if-elif-else (d) for-break 16- Which of the following properly expresses the precedence of operators (using parentheses) in the following expression: 6 * 22 > 30 and 11 + 8 == 29 (a) ((6*22) > 30) and ((11+8) == 29) (b) (6* (22 > 30)) and ((11+8) == 29) (c) ((6*22) > 30) and (11+ (8 == 29)) (d) ((6*22) > (30 and ((11+8)) == 29) 17- What’s the output of this code? y = 3 x = 4 if y == 2 else 3 z = 2 if x and y > 3 else 1 np = [3,2,1,7,4] if y > 2: x = z z = y y = x else: x = y z = x for i in np: print(i+x+y*z) (a) 7 6 5 11 8 (b) 9 8 7 13 8 (c) 37 (d) 45 18- What’s the output of this code? def my_function(num): return num + 15 my_function(10) print(num) (a) 10 (b) 20 (c) 15 (d) An error 19- What’s the output of this code? def outer_fun(a, b): def inner_fun(c, d): return c + d return inner_fun(a, b) result = outer_fun(5, 10) print(result) (a) (5, 10) (b) (10, 5) (c) 15 (d) An error 20- A Python function always returns a value, and it can return multiple values. (a) True (b) False Answers 1- a 2- b 3- a 4- b 5- a 6- b 7- b 8- a 9- a 10- a 11- a 12- b 13- b 14- a 15- c 16- a 17- a 18- d 19- c 20- a