This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 31 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 31 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the main emphasis of Python? A) Complexity of syntax. B) Code readability. C) Memory management. D) Speed of execution. Show Answer Correct Answer: B) Code readability. 2. What is the syntax error with this code:print( "Hello World" ); A) Colon is not needed. B) No brackets around "Hello World". C) Speech marks are not needed. D) Print is spelt incorrectly. E) Print has a capital P. Show Answer Correct Answer: A) Colon is not needed. 3. Used to make comments A) **. B) %. C) #. D) (). Show Answer Correct Answer: C) #. 4. What does the following code do? "'pythonfor i in range(3):print(i) "' A) Prints 1, 2, 3. B) Prints 0, 1, 2, 3. C) Prints 0, 1, 2. D) Prints 3 times. Show Answer Correct Answer: C) Prints 0, 1, 2. 5. Which construct lets Python choose among more than two paths? A) Only if and else. B) If with multiple elif. C) Print( ). D) Functions with return. Show Answer Correct Answer: B) If with multiple elif. 6. What will be the output of the following code? "'pythonnumbers = [10, 20, 30]print(numbers[1]) "' A) 'Error'. B) '30'. C) '10'. D) '20'. Show Answer Correct Answer: D) '20'. 7. Which programming language uses loops? A) Python only. B) Scratch only. C) Both Scratch and Python. D) Neither Scratch nor Python. Show Answer Correct Answer: C) Both Scratch and Python. 8. A compiler is a software program that: A) Executes machine code directly. B) Converts high-level code to machine code. C) Translates assembly code to machine code. D) None of the above. Show Answer Correct Answer: B) Converts high-level code to machine code. 9. What is a Constant? A) A storage location of memory which does not change. B) A random area to store things in. C) Something that changes. D) Something that can only store numbers. Show Answer Correct Answer: A) A storage location of memory which does not change. 10. What is the result of the expression 9 * 3 in Python? A) 25. B) 26. C) 27. D) 28. Show Answer Correct Answer: C) 27. 11. Who designed Python? A) Dennis Ritchie. B) James Gosling. C) Bjarne Stroustrup. D) Guido van Rossum. Show Answer Correct Answer: D) Guido van Rossum. 12. Which symbol is used to start a comment in Python? A) //. B) #. C) <$\rightarrow$. D) **. Show Answer Correct Answer: B) #. 13. Which of the following statements will correctly check if a variable 'a' is equal to 10? A) If a = 10:. B) If a === 10:. C) If a == 10:. D) If a equals 10:. Show Answer Correct Answer: C) If a == 10:. 14. What is the purpose of the IDLE interpreter in Python? A) To debug Python code. B) To compile Python code. C) To interpret and run Python code. D) To manage Python packages. Show Answer Correct Answer: C) To interpret and run Python code. 15. What do we use variables for? A) To store data. B) Print data. C) Produce functions. D) None of the above. Show Answer Correct Answer: A) To store data. 16. Which of the following is a float in Python? A) 7.0. B) 7. C) "7.0". D) '7'. Show Answer Correct Answer: A) 7.0. 17. What is the purpose of the 'elif' statement in Python? A) To end a loop. B) To define a function. C) To create a loop. D) To handle multiple conditions. Show Answer Correct Answer: D) To handle multiple conditions. 18. Which statement shows understanding of why tuples are handy in programs? A) They protect contents from accidental changes. B) They allow frequent in-place edits easily. C) They store elements without any order. D) They require more memory than lists always. Show Answer Correct Answer: A) They protect contents from accidental changes. 19. What are keywords in Python? Give an example. A) An example of a keyword in Python is 'def', which is used to define a function. B) 'input' is a keyword for taking user input. C) 'print' is a keyword used for outputting text. D) 'return' is a keyword that ends a function. Show Answer Correct Answer: A) An example of a keyword in Python is 'def', which is used to define a function. 20. Is the result of the following code:print(random.randint(3, 9)) A) 9. B) Prints the word:random. C) 3. D) Prints a random number between 3 & 9. Show Answer Correct Answer: D) Prints a random number between 3 & 9. 21. Which of the following is NOT an example of a high-level programming language? A) Machine language. B) C++. C) Kotlin. D) Java. Show Answer Correct Answer: A) Machine language. 22. What file extension should you use to save a Python script in IDLE? A) .py. B) .doc. C) .txt. D) .java. Show Answer Correct Answer: A) .py. 23. Which of the following is used to create a function in Python? A) Def. B) Func. C) Create. D) Function. Show Answer Correct Answer: A) Def. 24. What will be the output of the following code? "'pythonname = input("Enter your name: ")print("Welcome, '' + name) "'If the user enters 'Alice', what is printed? A) Enter your name:Alice. B) Welcome, Alice. C) Welcome Alice. D) Alice Welcome. Show Answer Correct Answer: B) Welcome, Alice. 25. What is the purpose of the task:first = user INPUT(), last = user INPUT(), OUTPUT:first + last? A) To delete first and last names. B) To combine first and last names. C) To compare first and last names. D) To separate first and last names. Show Answer Correct Answer: B) To combine first and last names. 26. Which function adds a counter to a list when used in a for loop? A) Range(). B) Append(). C) Enumerate(). D) Count(). Show Answer Correct Answer: C) Enumerate(). 27. What is the main advantage of using Python over Java? A) More libraries. B) Easier learning curve. C) Better for system programming. D) Faster performance. Show Answer Correct Answer: B) Easier learning curve. 28. How to create a numeric variable age with a value of 10 A) Age = 10. B) Int age = 10. C) Age = "10". D) None of the above. Show Answer Correct Answer: A) Age = 10. 29. What is the purpose of the input() function? A) To read files from the system. B) To execute a command in the terminal. C) To take input from the user. D) To display output to the user. Show Answer Correct Answer: C) To take input from the user. 30. Why are tuples considered immutable? A) Their elements cannot be changed after creation. B) Their size can change dynamically. C) They are faster than lists. D) Their elements can be modified. Show Answer Correct Answer: A) Their elements cannot be changed after creation. 31. Input("Enter the password")Inside the bracket is known as a ..... A) Promise. B) Prompt. C) Printing. D) Press. Show Answer Correct Answer: B) Prompt. 32. What is the output of the below code snippet?tup1=([3, 6], [2, 1])list1=[(8, 9), (7, 0)]list2=tup1[0]list2[1]=5list1[1]=(5, 2)print(tup1, list1) A) ([3, 6], [2, 1]) [(8, 9), (5, 2)]. B) Error. C) ([3, 5], [2, 1]) [(8, 9), (5, 2)]. D) None of the above. Show Answer Correct Answer: C) ([3, 5], [2, 1]) [(8, 9), (5, 2)]. 33. How are letters represented in binary? A) By using a standard mapping of numbers to letters. B) By using a system called unary. C) By using a system called hexadecimal. D) By using a system called octal. Show Answer Correct Answer: A) By using a standard mapping of numbers to letters. 34. Which of the following is a valid way to append an element to a list in Python? A) 'list.push(element)'. B) 'list.append(element)'. C) 'list.insert(element)'. D) 'list.add(element)'. Show Answer Correct Answer: B) 'list.append(element)'. 35. What will be printed after running this FOR loop:for number in range(6):print(number) A) The number 6. B) The numbers 0-5. C) The number 5. D) The numbers 1-6. Show Answer Correct Answer: B) The numbers 0-5. 36. Which of the following is an application of Python? A) Gardening. B) Playing sports. C) Cooking recipes. D) Game development. Show Answer Correct Answer: D) Game development. 37. How to check the datatype? A) Type . B) Type(). C) Type. D) Type="". Show Answer Correct Answer: B) Type(). 38. What can you do with Python? A) Python can only be used for gaming development. B) Python is only suitable for basic scripting tasks. C) Python is a popular programming language for database management. D) Python can be used for web development, data analysis, artificial intelligence, automation, and more. Show Answer Correct Answer: D) Python can be used for web development, data analysis, artificial intelligence, automation, and more. 39. Which symbol is used to separate string and integer data? A) ". B) (. C) :. D) ,. Show Answer Correct Answer: D) ,. 40. Which subprogram in PLS is used to return the length of an object? A) Ord. B) Len. C) Print. D) Range. Show Answer Correct Answer: B) Len. 41. What is the purpose of identifiers in Python? A) To handle exceptions. B) To create loops. C) To name variables and functions. D) To define functions. Show Answer Correct Answer: C) To name variables and functions. 42. For tuple t = (0, False, 3), what is the step at which any(t) returns True? A) It never returns True for this tuple. B) At the first element, 0 is truthy. C) At the second element, False is truthy. D) At the third element, 3 is truthy. Show Answer Correct Answer: D) At the third element, 3 is truthy. 43. # in Python programming refers to A) Comments. B) Importing Library. C) Hash Tag. D) Random Operator. Show Answer Correct Answer: A) Comments. 44. What is a multi-line statement in Python? A) A function that takes multiple arguments. B) A statement that spans multiple lines. C) A variable that holds multiple values. D) A comment that is longer than one line. Show Answer Correct Answer: B) A statement that spans multiple lines. 45. What is the purpose of the tab key in Python programming? A) To save the file. B) To run the program. C) To indent a line. D) To delete a line. Show Answer Correct Answer: C) To indent a line. 46. A variable may be assigned a value of one type, and then later assigned a value of a different type: A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 47. Which of the following is the first step in setting up Python? A) Installing Python. B) Learning syntax. C) Debugging code. D) Writing a program. Show Answer Correct Answer: A) Installing Python. 48. Which data structure does NOT allow duplicate values? A) Tuple. B) List. C) Set. D) String. Show Answer Correct Answer: C) Set. 49. What is the correct way to declare a constant in Python? A) PI = 3.14. B) Const PI = 3.14. C) Let PI = 3.14. D) PI:= 3.14. Show Answer Correct Answer: A) PI = 3.14. 50. Tuples are enclosed with in ..... A) ( ) symbols. B) [ ] symbols. C) < > symbols. D) { } symbols. Show Answer Correct Answer: A) ( ) symbols. 51. What will be the output of the following code?for i in range(3):print("Hello")else:print("Done") A) Hello Hello Hello. B) Hello Done. C) Hello Hello Hello Done. D) Hello Hello Done. Show Answer Correct Answer: C) Hello Hello Hello Done. 52. What are the two main types of errors in programming? A) Syntax errors and Logical errors. B) Syntax errors and Runtime errors. C) Runtime errors and Logical errors. D) Syntax errors and Semantic errors. Show Answer Correct Answer: B) Syntax errors and Runtime errors. 53. What is missing from this line of code? A) Pencolor('red'). B) Pencolor("red"). C) Pencolor(red, blue). D) Pencolor(red). Show Answer Correct Answer: B) Pencolor("red"). 54. Which of the following cannot be a variable? A) Init . B) It. C) On. D) In. Show Answer Correct Answer: D) In. 55. Fungsi bawaan (built-in function) adalah fungsi yang ..... A) Dapat didefinisikan oleh pengguna sesuai kebutuhan. B) Semua jawaban benar. C) Dapat mengembalikan lebih dari satu nilai. D) Dapat dipanggil tanpa perlu mengimpor modul atau pustaka. Show Answer Correct Answer: D) Dapat dipanggil tanpa perlu mengimpor modul atau pustaka. 56. What is the purpose of the 'Disable path length limit' option in the Python setup? A) To shorten the path length. B) To allow longer file paths. C) To restrict file paths. D) To delete file paths. Show Answer Correct Answer: B) To allow longer file paths. 57. Python language use A) Upper case letters. B) Lower case letters. C) Upper and lower case letters. D) None of the above. Show Answer Correct Answer: B) Lower case letters. 58. Consider fruits = ('apple', 'banana', 'cherry'). Which conditional correctly prints 'Not found' when an item is absent? A) If fruits in item:print('Not found'). B) If item in fruits:print('Not found'). C) If fruits not in item:print('Not found'). D) If item not in fruits:print('Not found'). Show Answer Correct Answer: D) If item not in fruits:print('Not found'). 59. Which file extension should you use to save your code as a Python program file? A) .py. B) .docx. C) .js. D) .html. Show Answer Correct Answer: A) .py. 60. Python accepts single ('), double (") and triple (" ' or """) quotes to denote strings. Which of the following is NOT acceptable Python syntax? A) Print("Hello World"). B) Print('Hello World"). C) Print(""'Hello World'""). D) Print('Hello World'). Show Answer Correct Answer: B) Print('Hello World"). ← 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