This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 84 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 84 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. How can you add a new column to a DataFrame? A) By assigning a list to a new column label. B) By using the append method on the DataFrame. C) By merging with another DataFrame. D) By using the insert method with a specific index. Show Answer Correct Answer: A) By assigning a list to a new column label. 2. In which decade was Python conceived? A) 1970s. B) 1980s. C) 1990s. D) 2000s. Show Answer Correct Answer: B) 1980s. 3. Which of the following is not a valid comparison operator in Python? A) ==. B) !==. C) <=. D) >. Show Answer Correct Answer: B) !==. 4. What is the output of the following code:t=(10, 20, 30, 40, 50, 50, 70)print(t[:::]) A) (10, 20, 30, 40, 50, 50, 70). B) Error. C) (10, 20, 30, 40). D) None of the above. Show Answer Correct Answer: B) Error. 5. Which of the following is the correct way to assign the value 3.5 to a variable called 'length'? A) Length = 3.5. B) 3.5 = length. C) Length == 3.5. D) Assign length 3.5. Show Answer Correct Answer: A) Length = 3.5. 6. What is the output of:print(5 + 4 * 2) A) 14. B) 13. C) 18. D) Error. Show Answer Correct Answer: B) 13. 7. How do you create a DataFrame from a list of tuples? A) Pd.DataFrame(list of tuples). B) Pd.DataFrame.from tuples(list of tuples). C) Pd.DataFrame.create(list of tuples). D) Pd.DataFrame(list of tuples, columns=['col1', 'col2']). Show Answer Correct Answer: A) Pd.DataFrame(list of tuples). 8. Name three built-in data types in Python. A) Set. B) Float. C) Tuple. D) Int, list, dict. Show Answer Correct Answer: D) Int, list, dict. 9. How do you print the number 123 in Python? A) Print(123). B) Print("123"). C) Both A and B. D) Echo 123. Show Answer Correct Answer: C) Both A and B. 10. What does the 'circle' command do? A) Stops the code. B) Draws a circle. C) Makes Tracy turn around. D) Moves Tracy forward. Show Answer Correct Answer: B) Draws a circle. 11. What will the following code output?x = 10while x > 5:print(x)x-= 2 A) 10, 8, 6. B) 10, 8, 6, 4. C) Infinite loop. D) None. Show Answer Correct Answer: A) 10, 8, 6. 12. Which of the following is an invalid variable name? A) N1. B) Num 1. C) Num 1. D) Sum1. Show Answer Correct Answer: B) Num 1. 13. What is syntax? A) Syntax is the word used to describe an error. B) Syntax is the rules of the programming language. C) It is used to read information. D) It is used to output information. Show Answer Correct Answer: B) Syntax is the rules of the programming language. 14. What is the output of the expression 'Hello' + ' World'? A) Error. B) Hello + World. C) HelloWorld. D) Hello World. Show Answer Correct Answer: D) Hello World. 15. Extra programs for a language that other people can use are called A) Schools. B) Stations. C) Libraries. D) None of the above. Show Answer Correct Answer: C) Libraries. 16. Why should you NOT write print("place ..... of ..... birth") when you want the value? A) It will crash the computer. B) Quotes make Python treat it as text, so it prints the name not the value. C) It deletes the variable. D) It turns the value into a number. Show Answer Correct Answer: B) Quotes make Python treat it as text, so it prints the name not the value. 17. Which of the following statements will cause an error in Python? A) Print("Hello"). B) Print(Hello). C) Print('Hello'). D) Print("Hello" + "World"). Show Answer Correct Answer: B) Print(Hello). 18. Which of the following is a correct way to iterate over a list using a for loop? A) 'for i in range(len(list)):'. B) 'for i in list:'. C) 'for i in 0 to len(list):'. D) 'for i in list.range():'. Show Answer Correct Answer: B) 'for i in list:'. 19. Which of the following is used to check if '5' is in the list 'numbers'? A) 5 in numbers. B) Numbers.has(5). C) Numbers.contains(5). D) 5 == numbers. Show Answer Correct Answer: A) 5 in numbers. 20. How do you close a file in Python? A) .readline(). B) .writelines(). C) .write(). D) .close(). Show Answer Correct Answer: D) .close(). 21. When creating a rectangle with the turtle, what angle is needed when turning? A) 120. B) 180. C) 45. D) 90. Show Answer Correct Answer: D) 90. 22. What is a correct way to declare a Python variable? A) Var x = 5. B) #x = 5. C) $ x = 5. D) X = 5. Show Answer Correct Answer: D) X = 5. 23. What is the correct way to check if a variable 'age' is greater than 12 in Python? A) If age > 12:. B) If age => 12:. C) If age >> 12:. D) If age = 12:. Show Answer Correct Answer: A) If age > 12:. 24. When you run this program what will this line of code do?name = input("Enter your name: ") A) Ask you to Enter your name and save your answer to Google Drive. B) Ask you to Enter your name and save your answer to My Documents. C) Ask you to Enter your name. D) Ask you to Enter your name and save your answer as a variable. Show Answer Correct Answer: D) Ask you to Enter your name and save your answer as a variable. 25. Which of these would work as a piece of code? A) If string="Dove". B) If string=="Dove". C) IF string="Dove":. D) If string=="Dove":. Show Answer Correct Answer: D) If string=="Dove":. ← PreviousNext →Related 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 8Class 11 Computer Science Chapter 2 Introduction To Python Quiz 9Class 11 Computer Science Chapter 2 Introduction To Python Quiz 10 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books