This quiz works best with JavaScript enabled. Home > Cbse > Class 11 > Science > Computer Science > Class 11 Computer Science Chapter 2 Introduction To Python – Quiz 17 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 2 Introduction To Python Quiz 17 (60 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What software do you use to write a program in Python? A) Word. B) IDLE. C) Powerpoint. D) Excel. Show Answer Correct Answer: B) IDLE. 2. What will be the output of print('Hello' + ' World')? A) Hello, World. B) HelloWorld. C) Hello World. D) Hello World!. Show Answer Correct Answer: C) Hello World. 3. How would you convert a string input to an integer in Python? A) Bool(input("Enter a number: ")). B) Float(input("Enter a number: ")). C) Int(input("Enter a number: ")). D) Str(input("Enter a number: ")). Show Answer Correct Answer: C) Int(input("Enter a number: ")). 4. What is the correct way to start a for loop in Python? A) For variable in iterable[]. B) For variable in iterable{}. C) For variable in iterable:. D) For (variable:iterable). Show Answer Correct Answer: C) For variable in iterable:. 5. Library Pandas digunakan untuk ..... A) Membuat grafik. B) Membuat antarmuka GUI. C) Analisis dan manipulasi data. D) Menyimpan data array. Show Answer Correct Answer: C) Analisis dan manipulasi data. 6. A person who writes a python program is called a- A) Developer. B) Coder. C) Programmer. D) Engineer. Show Answer Correct Answer: C) Programmer. 7. Which of the following is NOT a valid way to concatenate strings in Python? A) "Hello" * "World". B) "Hello" + '' '' + "World". C) "Hello" + "World". D) "Hello" "World". Show Answer Correct Answer: A) "Hello" * "World". 8. What does print(10 % 3) output? A) 1. B) 10. C) 0. D) 3. Show Answer Correct Answer: A) 1. 9. What is a Python class? A) A procedure related to an object. B) A function to create an object. C) A template (blueprint) for creating objects. D) A process that repeats are directed. Show Answer Correct Answer: C) A template (blueprint) for creating objects. 10. In game development, what role can Python play? A) Programming game functions. B) Selling game supplies. C) Creating game stories. D) Making game boxes. Show Answer Correct Answer: A) Programming game functions. 11. How do you access a value in a dictionary? A) Access values with dict[key] only if the key exists. B) Use dict.value(key) to retrieve a value. C) Use dict.access(key) to find a value in a dictionary. D) Use dict[key] or dict.get(key) to access a value in a dictionary. Show Answer Correct Answer: D) Use dict[key] or dict.get(key) to access a value in a dictionary. 12. Name = "teacher kim"new ..... name = nameFollowing variable declaration above, we created how many objects and how many references? A) Two objects, two references. B) One object, two references. C) Two objects, one reference. D) One object, one reference. Show Answer Correct Answer: B) One object, two references. 13. Manakah di antara berikut ini yang merupakan tipe data yang dapat diubah (mutable) di Python? A) Set. B) Dictionary. C) List. D) Tuple. Show Answer Correct Answer: C) List. 14. Which of the following is used to format strings in Python? A) Output(). B) Print(). C) Style(). D) Format(). Show Answer Correct Answer: D) Format(). 15. Which of these pieces of code would return the name "Harry" from the following list?nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"] A) NameList(4). B) NameList["4"]. C) NameList(). D) NameList[1]. Show Answer Correct Answer: D) NameList[1]. 16. What does an if statement do? A) Close the program. B) Write a comment. C) Ask a question. D) Make a decision. Show Answer Correct Answer: D) Make a decision. 17. An ordered set of instructions to be executed by a computer to carry out a specific task is called ..... A) None of the above. B) Pseudocode. C) Algorithm. D) Program. Show Answer Correct Answer: D) Program. 18. Which statement about variable naming is correct? A) Variable can start with a number. B) Variable can start with an underscore. C) Variable can include # and *. D) Variable can include spaces. Show Answer Correct Answer: B) Variable can start with an underscore. 19. How do you close the file? A) Close = MyFile(). B) MyFile.close(). C) MyFile.close. D) MyFile = close(). Show Answer Correct Answer: B) MyFile.close(). 20. Explain the concept of operator precedence in Python. A) Operator precedence in Python dictates the order of operations in expressions, with higher precedence operators evaluated first. B) All operators in Python have the same precedence level. C) Operator precedence only applies to arithmetic operations in Python. D) Operator precedence in Python is irrelevant to expression evaluation. Show Answer Correct Answer: A) Operator precedence in Python dictates the order of operations in expressions, with higher precedence operators evaluated first. 21. What will be the output of the following code? "'pythonname = "Sam"print("Hello, '' + name) "' A) Hello, name. B) Hello, Sam. C) Sam, Hello. D) Error. Show Answer Correct Answer: B) Hello, Sam. 22. Which of the following function can be used to find the data type of a variable? A) Data(). B) Str(). C) Type(). D) True(). Show Answer Correct Answer: C) Type(). 23. How do you import a module in Python? A) Import module name. B) Load module name. C) Require module name. D) Include module name. Show Answer Correct Answer: A) Import module name. 24. Which of the following is a high-level programming language? A) Machine Code. B) Assembly. C) Python. D) Binary. Show Answer Correct Answer: C) Python. 25. Which string subprogram is used to replace all occurrences of a certain string within another string? A) .split(). B) .replace(, ). C) .index(). D) .strip(). Show Answer Correct Answer: B) .replace(, ). 26. What will be the data type of x after the following statement if input entered is 18? x = input('Enter a number:') A) List. B) String. C) Integer. D) Float. Show Answer Correct Answer: B) String. 27. What is the correct syntax for assigning the value 10 to a variable named x in Python? A) Let x = 10. B) X:= 10. C) X == 10. D) X = 10. Show Answer Correct Answer: D) X = 10. 28. Python programming use COMPILER to translate the source code A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: B) FALSE. 29. Which symbol represents multiplication? A) +. B) *. C) /. D) **. Show Answer Correct Answer: B) *. 30. Which of the following is a valid variable name? A) Var-name. B) Var1. C) Var!. D) 1var. Show Answer Correct Answer: B) Var1. 31. Which of the following is the correct syntax for a for loop in Python? A) For (i = 0; i < 5; i++):print(i). B) Foreach i in range(5):print(i). C) For i in range(5):print(i). D) For i = 0 to 5:print(i). Show Answer Correct Answer: C) For i in range(5):print(i). 32. What is a commenting line? A) It is where you comment on something. B) A line which is strait. C) Commenting line helps the reader to understand the code for future purposes. D) None of these. Show Answer Correct Answer: C) Commenting line helps the reader to understand the code for future purposes. 33. What will be the output of the following code?x = 2y = 3print(x)x = x + yprint(x) A) 23. B) 25. C) It will produce an error. D) 2. E) 5. Show Answer Correct Answer: B) 25. 34. In programming, a (n) ..... is a value that can change, depending on conditions or on information passed to the program A) Variable. B) String. C) Instruction. D) Block. Show Answer Correct Answer: A) Variable. 35. What is the output for ' ' in 'python'? A) Error. B) False. C) For loop runs perfectly. D) True. Show Answer Correct Answer: B) False. 36. Both the print statement will return same output (T/F) A) Not applicable. B) Depends on the context. C) False. D) True. Show Answer Correct Answer: D) True. 37. What does PLS use for the conversion between data types? A) Only casting operators like (int), (str), (float). B) Conversion is not possible in PLS. C) Conversion functions like int(), str(), float(), bool(), or list(). D) Automatic type casting without any functions. Show Answer Correct Answer: C) Conversion functions like int(), str(), float(), bool(), or list(). 38. Which of the following is the correct way to write a multi-line comment in Python? A) /* This is a comment */. B) // This is a comment. C) """This is a comment""". D) None of the above. Show Answer Correct Answer: C) """This is a comment""". 39. Which of the following keywords is used to create a loop in Python? A) Loop. B) Iterate. C) For. D) Repeat. Show Answer Correct Answer: C) For. 40. What is a loop in Python? A) A loop in Python is a control structure for repeated execution of code. B) A loop in Python is a function that returns a value. C) A loop in Python is a method for defining classes. D) A loop in Python is a data type for storing values. Show Answer Correct Answer: A) A loop in Python is a control structure for repeated execution of code. 41. A CONDITION in Python always evaluates to A) A code block. B) A string. C) 0 (zero). D) True or False. Show Answer Correct Answer: D) True or False. 42. None in Python has which data type? A) False. B) Integer. C) NoneType. D) Does not have one. Show Answer Correct Answer: C) NoneType. 43. Which of the following is NOT a numeric type in Python? A) Int. B) Complex. C) String. D) Float. Show Answer Correct Answer: C) String. 44. Why must programs written in high-level programming languages be converted to machine code? A) Because machine code is easier for humans to read. B) Because computers can only understand machine code in binary. C) Because high-level languages are too complex for computers. D) Because high-level languages are not secure. Show Answer Correct Answer: B) Because computers can only understand machine code in binary. 45. Which keyword starts a conditional in Python? A) If. B) When. C) Check. D) Else. Show Answer Correct Answer: A) If. 46. What is the result of the following code? "'pythonweight = 12print(weight, "kg") "' A) "weight kg". B) Kg 12. C) Error. D) 12 kg. Show Answer Correct Answer: D) 12 kg. 47. In Python, a variable must be declared before it is assigned a value: A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 48. How do you add data in SQL? A) INSERT NEW. B) ADD RECORD. C) ADD. D) INSERT INTO. Show Answer Correct Answer: D) INSERT INTO. 49. How do you access a specific cell in a DataFrame? A) Using the .loc[] method with row and column labels. B) Using the .get() method with row and column indices. C) Using the .cell() method with row and column numbers. D) Using the .select() method with row and column names. Show Answer Correct Answer: A) Using the .loc[] method with row and column labels. 50. Pernyataan if digunakan untuk ..... A) Menyimpan data dalam jumlah yang sangat besar. B) Menghapus variabel. C) Memeriksa kondisi benar atau salah. D) Mengulangi perintah. Show Answer Correct Answer: C) Memeriksa kondisi benar atau salah. 51. What does the string subprogram .isalpha() return? A) True, if all characters are digits. B) True, if all characters are alphabetic, A-Z. C) True, if all characters are uppercase. D) True, if all characters are lowercase. Show Answer Correct Answer: B) True, if all characters are alphabetic, A-Z. 52. Which collection will any() consider truthy? A) {} empty dict. B) [] empty list. C) [1] non-empty list. D) () empty tuple. Show Answer Correct Answer: C) [1] non-empty list. 53. What is selection? A) A decision or question where a program can branch out. B) Choosing an item from a list. C) Printing text to the screen. D) Checking if two variables are equal to each other. Show Answer Correct Answer: A) A decision or question where a program can branch out. 54. Is the comparison operator in python A) ==. B) =. C) = *. D) ===. Show Answer Correct Answer: A) ==. 55. What is the output of print(2 ** 3)? A) 6. B) 5. C) 8. D) 9. Show Answer Correct Answer: C) 8. 56. What command is used in python to display output? A) PRINT. B) Print ("Hello World"). C) Print(). D) Print. Show Answer Correct Answer: C) Print(). 57. Write the output of the following code:7+2//1**2 > 5+2**2//3 A) Error. B) False. C) None of the above. D) True. Show Answer Correct Answer: D) True. 58. Which of the following are valid identifiers? A) X, abel, road y, 40. B) If, else, 2baba, road Y, #size. C) Import, def, 2baba, road Y, #size. D) Print, while, 69ine, road y, 40. Show Answer Correct Answer: A) X, abel, road y, 40. 59. What language do we use? A) Python. B) Spanish. C) Computer. D) English. Show Answer Correct Answer: A) Python. 60. What is the purpose of the 'def ():' syntax in Python? A) To write a string to a file. B) To define a function with parameters. C) To open a file for reading. D) To define a function with no parameters. Show Answer Correct Answer: D) To define a function with no parameters. ← 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