Alien Institute of Computer Post author:web techy Post published:February 10, 2024 Post category:Uncategorized Post comments:0 Comments Alien Institute of Computer: Monthly Test This is our first Python Theory Test 0% The test is Over. Python Test Python Theory Test 1 / 70 1. Which operator is used to check if an element is present in a sequence in Python? not in in is not 2 / 70 2. What does the logical AND operator and return if both operands are True? True False None Error 3 / 70 3. Which operator is used for assignment in Python? == = === != 4 / 70 4. What is the purpose of the modulo operator % in Python? Returns the remainder of division Performs integer division Raises a number to a power Concatenates two strings 5 / 70 5. What is the result of 10 // 3 in Python? 3.333 3 3.0 4 6 / 70 6. Which operator is used for exponentiation in Python? ^ ** * / 7 / 70 7. What is the purpose of the addition operator + in Python? Concatenates two strings Performs logical AND operation Raises a number to a power Adds two numbers 8 / 70 8. What is the result of pow(2, 3) in Python? 8 2 5 Error 9 / 70 9. What is the result of 7 % 3 in Python? 2 3 1 0 10 / 70 10. What does the // operator do in Python? Performs normal division Performs exponentiation Performs floor division, returning only the integer part of the quotient None of the above 11 / 70 11. What is the result of 10 / 2 in Python? 5.0 5 2.5 Error 12 / 70 12. Which of the following is an integer number in Python? 3.14 42 '42' ['4.2'] 13 / 70 13. What is an integer in Python? A data type used to store numbers with decimal points A data type used to store sequences of characters A data type used to store whole numbers without decimal points A data type used to store True or False values 14 / 70 14. What is the result of int(3.9) in Python? 3 4 3.0 4.0 15 / 70 15. What is the result of float('3.14') in Python? 3.14 '3.14' 3 Error 16 / 70 16. Which of the following is true about the float data type in Python? Float numbers cannot have a fractional part Float numbers are always positive Float numbers can be negative Float numbers cannot be represented in scientific notation 17 / 70 17. What does the round() function do when applied to a float number? Rounds the number up to the nearest integer Rounds the number down to the nearest integer Rounds the number to the nearest integer Raises an error 18 / 70 18. Which function can be used to convert a string to a float in Python? str() int() float() convert() 19 / 70 19. What is the result of 5.0 / 2 in Python? 2.5 2 2.0 2.25 20 / 70 20. Which of the following is a float number in Python? 10 [3.14] '3.14' 3.14 21 / 70 21. How are float numbers represented in Python? Whole numbers without any decimal points Numbers with decimal points Only negative numbers Numbers with no fractional part 22 / 70 22. What is a float in Python? A data type used to store integers A data type used to store strings A data type used to store floating-point numbers A data type used to store lists 23 / 70 23. Which logical operator is used to perform an "and" operation in Python? && || not and 24 / 70 24. Which of the following comparison operators is used to check if two values are equal in Python? == != <= >= 25 / 70 25. What is the result of the expression 5 > 3 in Python? True False None Error 26 / 70 26. What are the possible boolean values in Python? True and False Yes and No On and Off Active and Inactive 27 / 70 27. How many boolean values are there in Python? 1 2 3 4 28 / 70 28. What is a boolean in Python? A data type used to store numbers A data type used to store sequences of characters A data type used to store True or False values A data type used to store lists 29 / 70 29. What does the copy() method do in Python lists? Copies the elements of one list to another list Makes a deep copy of the list Makes a shallow copy of the list Copies the list and reverses the order of elements 30 / 70 30. Which method is used to clear all elements from a list? clear() removeAll() empty() erase() 31 / 70 31. What does the extend() method do in Python lists? Adds an element to the end of the list Removes the last element of the list Replaces occurrences of a specific element with another element Extends the list by appending elements from another list 32 / 70 32. Which method is used to make a shallow copy of a list in Python? copy() clone() duplicate() replicate() 33 / 70 33. What does the count() method do in Python lists? Counts the number of occurrences of a specific character in the list Counts the number of occurrences of a specific substring in the list Counts the number of elements in the list Counts the number of occurrences of a specific element in the list 34 / 70 34. Which method is used to sort the elements of a list in ascending order? sorted() sort() arrange() order() 35 / 70 35. Which method is used to reverse the order of elements in a list? reverse() sort() flip() rearrange() 36 / 70 36. What does the pop() method do in Python lists? Appends an element to the end of the list Removes the first occurrence of a specific element from the list Removes the element at a specific index from the list and returns it Removes all occurrences of a specific element from the list 37 / 70 37. Which method is used to insert an element at a specific index in a list? add() insert() append() put() 38 / 70 38. What does the remove() method do in Python lists? Removes a specific element from the list Removes all occurrences of a specific element from the list Removes the last element of the list Removes all elements from the list 39 / 70 39. Which of the following is the correct way to add an element to the end of a list in Python? list.extend(element) list.insert(element) list.append(element) list.add(element) 40 / 70 40. What method is used to find the length of a list in Python? count() size() len() length() 41 / 70 41. What does it mean that lists are mutable in Python? Lists cannot be changed after they are created Lists can only contain integers Lists can be modified freely Lists can only have a fixed length 42 / 70 42. How do you create an empty list in Python? list = {} list = () list = [] list = 43 / 70 43. What is a list in Python? A data type used to store a single value A data type used to store only integers A data type used to store a collection of elements A data type used to store only strings 44 / 70 44. What does the isdigit() method check for in a string? Checks if the string is empty Checks if all characters in the string are alphanumeric Checks if all characters in the string are digits Checks if all characters in the string are whitespace 45 / 70 45. Which method is used to capitalize the first character of a string? upper() capitalize() first() start() 46 / 70 46. Which method is used to convert the characters of a string to lowercase? lowercase() tolower() lower() case() 47 / 70 47. What does the join() method do in Python? Joins two strings together Joins elements of a list into a string Joins elements of a string into a list Joins elements of a tuple into a string 48 / 70 48. Which method is used to split a string into a list of substrings based on a delimiter? divide() slice() cut() split() 49 / 70 49. Which of the following is the correct way to concatenate two strings in Python? string1 + string2 string1.concatenate(string2) string1.concat(string2) concat(string1, string2) 50 / 70 50. What method is used to find the length of a string in Python? length() len() size() count() 51 / 70 51. What does it mean that strings are immutable in Python? Strings can be modified freely Strings can only contain alphabetical characters Strings cannot be changed after they are created Strings can only have a fixed length 52 / 70 52. Which of the following is the correct way to create a string in Python? string = "Hello, World!" string = (Hello, World!) string = ['Hello, World!'] string = {"Hello, World!"} 53 / 70 53. What is a string in Python? A data type used to store integers A data type used to store sequences of characters A data type used to store floating-point numbers A data type used to store Boolean values 54 / 70 54. How do you read user input in Python? Using the format() method Using the read() function Using the write() function Using the input() function 55 / 70 55. How do you check the type of an object in Python? Using the type() function Using the str() function Using the len() function Using the format() method 56 / 70 56. How do you convert a string to an integer in Python? Using the int() function Using the str() function Using the float() function Using the bool() function 57 / 70 57. How do you comment out code in Python? Using triple quotes (""" or ''') Using the # symbol Using the /* */ syntax Using the // symbol 58 / 70 58. What is a module in Python? A type of function A block of code A file containing Python code A type of loop 59 / 70 59. What is the purpose of the append() method in Python lists? To remove an element from a list To add an element to the end of a list To sort a list To reverse a list 60 / 70 60. What does the range() function do in Python? It calculates the square root of a number It generates a sequence of numbers It finds the remainder of division It converts a string to lowercase 61 / 70 61. What is the purpose of the len() function in Python? To return the length of an object To concatenate strings To convert a string to uppercase To find the maximum value in a list 62 / 70 62. Explain the concept of a dictionary in Python. An ordered collection of elements A mutable collection of key-value pairs An unordered collection of elements A collection of tuples 63 / 70 63. What are the different types of loops in Python? For loop, While loop, and Nested loop. If loop, While loop, and Do-while loop. For loop, While loop, and Nested loop. For loop, While loop, and Foreach loop. 64 / 70 64. What is the purpose of the if statement in Python? To define a function To execute a block of code only if a certain condition is true To iterate over a sequence of elements To assign a value to a variable 65 / 70 65. What is a function in Python? A block of code that performs a specific task A keyword A type of loop A type of variable 66 / 70 66. What is the difference between == and = in Python? Both are used for assignment. == is used for assignment, while = is used for comparison. Both are used for comparison. == is used for comparison, while = is used for assignment. 67 / 70 67. Explain the difference between list and tuple. Lists are immutable, tuples are mutable Tuples are ordered, lists are unordered Lists are mutable, tuples are immutable Tuples have a fixed size, lists do not 68 / 70 68. What are the benefits of using Python? Complexity and unreadability Limited libraries Slow performance Cross-platform compatibility and simplicity 69 / 70 69. What is the significance of indentation in Python? It is a requirement enforced by Python syntax for proper code execution. It is purely for aesthetic purposes. It helps to make the code more readable and maintainable. It allows programmers to align code blocks for better organization. 70 / 70 70. What is Python? A low-level programming language. A type of snake found in Asia. A high-level programming language. A type of pasta commonly used in Italian cuisine. Your score isThe average score is 58% 0% Restart Test You Might Also Like Alien Institute of Computer February 29, 2024 Alien Institute of Computer February 29, 2024 Alien Institute of Computer February 29, 2024 Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.