This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 26 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 26 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Is the statement valid/invalidx+1=x A) Valid. B) Invalid. C) All the above. D) None of the above. Show Answer Correct Answer: B) Invalid. 2. Write the output of the following:def abc():print('abc') A) Error. B) 0. C) Abc. D) No Output. Show Answer Correct Answer: D) No Output. 3. Which function is used to get user input in Python 3? A) Input(). B) Scan(). C) Get(). D) Read(). Show Answer Correct Answer: A) Input(). 4. X = ['ab', 'cd']for i in x:i.upper()print(x) A) ['ab', 'cd']. B) ['AB', 'CD']. C) All the above. D) None of the above. Show Answer Correct Answer: A) ['ab', 'cd']. 5. What will be the output of the following code? "'pythonprint("5" + "6") "' A) 11. B) 5 6. C) 56. D) Error. Show Answer Correct Answer: C) 56. 6. Variabel dalam Python digunakan untuk ..... A) Menyimpan nilai dengan nama simbolis. B) Menampilkan teks ke layar. C) Menentukan warna tampilan yang sangat menarik untuk user dapat digunakan. D) Menghapus data. Show Answer Correct Answer: A) Menyimpan nilai dengan nama simbolis. 7. What is the main purpose of comments in Python? A) To increase the runtime performance of the program. B) To provide clarity and context to the code. C) To replace the need for documentation. D) To execute code more efficiently. Show Answer Correct Answer: B) To provide clarity and context to the code. 8. The suitable data type to store the value 9.76 A) Boolean. B) Float. C) Integer. D) String. Show Answer Correct Answer: B) Float. 9. What is the output of the following code?food = "burgers"number = 6print(number + food) A) 6 burgers. B) 6 "burgers". C) It will produce an error. D) 6burgers. Show Answer Correct Answer: C) It will produce an error. 10. Which of the following is a correct Python command to print 'hello world'? A) Echo 'hello world'. B) Printf('hello world'). C) Print('hello world'). D) System.out.println('hello world'). Show Answer Correct Answer: C) Print('hello world'). 11. Given t = (4, 1, 3, 2), which statement creates a list sorted ascending without changing t? A) T.sort() returns [1, 2, 3, 4]. B) Sorted(t) returns [1, 2, 3, 4]. C) Tuple(sorted(t)) returns [1, 2, 3, 4]. D) List(t).sort() returns [1, 2, 3, 4]. Show Answer Correct Answer: B) Sorted(t) returns [1, 2, 3, 4]. 12. The value that represents the absence of any value in Python is: A) None. B) Nothing. C) Not. D) Nein. Show Answer Correct Answer: A) None. 13. Which of the following is a binary number? A) 10001011. B) 12378611. C) 3.14. D) None of the above. Show Answer Correct Answer: A) 10001011. 14. How do you write a comment in Python so that the text is ignored by the computer? A) . B) /* This is a comment */. C) // This is a comment. D) # This is a comment. Show Answer Correct Answer: D) # This is a comment. 15. What is one way Python is used in video games? A) Designing game boxes. B) Writing the music. C) Programming game characters. D) Drawing game art. Show Answer Correct Answer: C) Programming game characters. 16. This data type is used to store a mixture of letters and numbers and symbols. A) Integer. B) String. C) Character. D) Boolean. Show Answer Correct Answer: B) String. 17. What is the answer to print (12/6)? A) 2. B) 6. C) 1. D) 10. Show Answer Correct Answer: A) 2. 18. Which of the following statements will cause a syntax error in Python? A) Print("Hello'. B) Print("Hello"). C) Print('Hello'). D) Print("Hello World"). Show Answer Correct Answer: A) Print("Hello'. 19. Which brackets are used to define a list in Python? A) []. B) {}. C) <>. D) (). Show Answer Correct Answer: A) []. 20. Tipe data apa yang digunakan untuk menyimpan teks dalam Python? A) Float. B) Bool. C) Str. D) Int. Show Answer Correct Answer: C) Str. 21. In which year was the Python language developed? A) 1989. B) 1981. C) 1995. D) 1972. Show Answer Correct Answer: A) 1989. 22. What will the following code output? "'pythonprint("The temperature is", 18, "degrees Celsius") "' A) The temperature is, 18, degrees Celsius. B) The temperature is18degrees Celsius. C) The temperature is 18. D) The temperature is 18 degrees Celsius. Show Answer Correct Answer: D) The temperature is 18 degrees Celsius. 23. Which of the following is used to create a dictionary in Python? A) []. B) (). C) ||. D) {}. Show Answer Correct Answer: D) {}. 24. Which of the following is not a valid data type in Python? a) Integer b) Float c) String d) Character A) C) String. B) A) Integer. C) B) Float. D) D. Show Answer Correct Answer: D) D. 25. COMMENTS BEGIN WITH ..... SYMBOL . A) #. B) @. C) %. D) None of the above. Show Answer Correct Answer: A) #. 26. Which one is a Python data type? A) Snack. B) Happy. C) Picture. D) Number. Show Answer Correct Answer: D) Number. 27. What is the main purpose of the Tkinter library in Python? A) Creating graphical user interfaces. B) Web development. C) Data analysis. D) Machine learning. Show Answer Correct Answer: A) Creating graphical user interfaces. 28. What does int() represent? A) Internet. B) Input. C) Intel. D) Integer. Show Answer Correct Answer: D) Integer. 29. What is the output of the following code snippet? "'pythonx = 5y = 10print(x + y) "' A) 5. B) 510. C) 15. D) 10. Show Answer Correct Answer: C) 15. 30. What will be the output of the following code? print("The length is", 5, "metres") A) The length is 5. B) The length is 5, metres. C) The length is 5 metres. D) The length is 5metres. Show Answer Correct Answer: C) The length is 5 metres. 31. Which of the following is an immutable data type? A) Dictionary. B) List. C) Set. D) Tuple. Show Answer Correct Answer: D) Tuple. 32. What is the output of the following code? 'print("The result is '' + str(5 + 3))' A) The result is 8. B) The result is 53. C) The result is 5 + 3. D) Error. Show Answer Correct Answer: A) The result is 8. 33. 42 is an example of what data type? A) Integer. B) Float. C) Boolean. D) None of the above. Show Answer Correct Answer: A) Integer. 34. What is wrong with the following function?def add (x, y):return x + zprint (add (3, 4) ) A) Z is not defined. B) Add function should return z. C) Add function should not have parameters. D) No errors. Show Answer Correct Answer: A) Z is not defined. 35. What will the following code print? "'pythonx = 10if x > 5:print("Greater")else:print("Smaller") "' A) Greater. B) Smaller. C) Error. D) Nothing. Show Answer Correct Answer: A) Greater. 36. What will be the output of the following code?x = 10if x > 5:print("x is greater than 5")else:print("x is 5 or less") A) No output. B) X is 5 or less. C) X is greater than 5. D) X is equal to 5. Show Answer Correct Answer: C) X is greater than 5. 37. What is the output of the following python code:tup1=(10, 20, 40, 60, 70)print(tup1[4:2]) A) (70, 60, 40). B) Blank output ( ). C) (70, 60, 40, 20). D) Error. Show Answer Correct Answer: B) Blank output ( ). 38. What kind of program does Python need? A) Machine code. B) Compiler. C) Assembler. D) Interpreter. Show Answer Correct Answer: D) Interpreter. 39. Which operator is used to reverse the logical state of its operand? A) !. B) Not. C) ~. D) -. Show Answer Correct Answer: B) Not. 40. Which statement best describes tuple immutability? A) You can freely append new values. B) Elements can be updated in place. C) Items are permanently fixed after creation. D) Order is unpredictable during runtime. Show Answer Correct Answer: C) Items are permanently fixed after creation. 41. Which of the following is not in Python Character Set? A) Digits:0-9. B) Whitespaces:blank space, tab etc. C) Letters:A-Z or a-z. D) Images:Vector. Show Answer Correct Answer: D) Images:Vector. 42. To add an item to the end of a list we can use which method? A) Add(). B) Append(). C) Remove(). D) End(). Show Answer Correct Answer: B) Append(). 43. Which of the following is a valid Python identifier? A) My-name. B) 2name. C) Myname. D) None of the above. Show Answer Correct Answer: C) Myname. 44. What does the 'round' subprogram in PLS do? A) Rounds to the number of digits after the decimal. B) Returns the length of the object. C) Displays the content of prompt to the screen. D) Returns the string which matches the Unicode value of. Show Answer Correct Answer: A) Rounds to the number of digits after the decimal. 45. How can you read a file in Python? A) Use 'with open(filename, 'r') as file:content = file.read()' to read a file in Python. B) Use 'open(filename) as file:content = file.read()' to read a file in Python. C) Employ 'with open(filename, 'w') as file:file.write(data)' to read a file in Python. D) Utilize 'open(filename, 'rb') as file:content = file.read()' to read a file in Python. Show Answer Correct Answer: A) Use 'with open(filename, 'r') as file:content = file.read()' to read a file in Python. 46. What is the name of this program? A) Data Control with Python. B) Data Analysis with Python. C) Python with Big Data. D) Data Analysis with Pandas. Show Answer Correct Answer: B) Data Analysis with Python. 47. What will be the output of the following code? "'pythonx = 5y = 10print(x + y) "' A) '5 + 10'. B) '15'. C) '510'. D) 'Error'. Show Answer Correct Answer: B) '15'. 48. What does this function do? input() A) Displays the word 'input'. B) Asks the user to type something in. C) Opens the CD tray. D) Exits the program. Show Answer Correct Answer: B) Asks the user to type something in. 49. What is operator precedence and how does it affect expressions in Python? A) Operator precedence is only relevant for arithmetic operations. B) Operator precedence has no impact on the execution of Python programs. C) Operator precedence affects the evaluation order of operators in expressions, influencing the final result. D) Operator precedence determines the data types used in expressions. Show Answer Correct Answer: C) Operator precedence affects the evaluation order of operators in expressions, influencing the final result. 50. You have a tuple temperatures = (12, 18, 5, 20). Which call finds the smallest temperature? A) Max(temperatures) finds the smallest. B) Len(temperatures) finds the smallest. C) Min(temperatures) finds the smallest. D) Sum(temperatures) finds the smallest. Show Answer Correct Answer: C) Min(temperatures) finds the smallest. 51. What is the command to create a DataFrame from a list of dictionaries? A) Pd.DataFrameBuilder(list of dicts). B) Pd.createDataFrame(list of dicts). C) Pd.DataFrame(list of dicts). D) Pd.DataFrame.from dict(list of dicts). Show Answer Correct Answer: C) Pd.DataFrame(list of dicts). 52. This particular data type has 2 potential values (typically True or False) A) Float. B) String. C) Integer. D) Boolean. Show Answer Correct Answer: D) Boolean. 53. What will following Python code return?str1="Stack of books" print(len(str1)) A) 16. B) 14. C) 15. D) 13. Show Answer Correct Answer: B) 14. 54. Given numbers = (1, 2, 3, 4); y = (5); numbers += y; What is the correct way to concatenate so print(numbers) shows (1, 2, 3, 4, 5)? A) Keep y = (5) which already works. B) Use y = 5 then numbers += y. C) Use y = (5, ) then numbers += y. D) Use y = [5] then numbers += y. Show Answer Correct Answer: C) Use y = (5, ) then numbers += y. 55. What will be the output of the following code? print('Python' * 2) A) Error:Cannot multiply. B) Python 2. C) PythonPython. D) 2Python. Show Answer Correct Answer: C) PythonPython. 56. Find The Output.L = [5, 2, 2, 7, 5, 4, 7]print(set(L)) A) 5, 2, 2, 7, 5, 4, 7. B) 2, 2, 2, 1. C) 2, 4, 5, 7. D) None of the above. Show Answer Correct Answer: C) 2, 4, 5, 7. 57. Find the outputprint(5**2) A) 10. B) 25. C) Error. D) 52. Show Answer Correct Answer: B) 25. 58. Which of these is NOT a Python keyword? A) If. B) For. C) Name. D) While. Show Answer Correct Answer: C) Name. 59. Which of the following is a correct way to create a list in Python? A) List = (1, 2, 3). B) List = <1, 2, 3>. C) List = [1, 2, 3]. D) List = {1, 2, 3}. Show Answer Correct Answer: C) List = [1, 2, 3]. 60. Which of the following is the correct way to start a multi-line comment in Python? A) //. B) /*. C) """. D) #. Show Answer Correct Answer: C) """. ← PreviousNext →Related QuizzesScience QuizzesClass 11 QuizzesClass 11 Computer Science Chapter 2 Introduction To Python Quiz 1Class 11 Computer Science Chapter 2 Introduction To Python Quiz 2Class 11 Computer Science Chapter 2 Introduction To Python Quiz 3Class 11 Computer Science Chapter 2 Introduction To Python Quiz 4Class 11 Computer Science Chapter 2 Introduction To Python Quiz 5Class 11 Computer Science Chapter 2 Introduction To Python Quiz 6Class 11 Computer Science Chapter 2 Introduction To Python Quiz 7Class 11 Computer Science Chapter 2 Introduction To Python Quiz 8 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books