Python Built In Functions — Part 1 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Python Built In Functions — Part 1 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which built-in function is used to find the smallest item in an iterable?
Correct Answer: Option A — min()
Detailed Academic Explanation:
The correct answer is Option A: min() . The min() function is used to find the smallest item in an iterable, such as a list, tuple, or set. It takes an iterable as an argument and returns the smallest item. For example: numbers = [5, 2, 8, 1, 6] smallest_number = min(numbers) print(smallest_number) # Output: 1
💡Key Conceptual Anchor:Python Built In Functions
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the built-in function round() do in Python?
Correct Answer: Option A — Rounds a floating-point number to the nearest integer
Detailed Academic Explanation:
The correct answer is Option A: Rounds a floating-point number to the nearest integer . The round() function in Python is used to round a floating-point number to the nearest integer. It takes one or two arguments. If given one argument, it rounds the number to the nearest integer. If given two arguments, it rounds the first argument to the number of decimal places specified by the second argument. For example: num1 = 3.7 num2 = 9.2 rounded_num1 = round(num1) rounded_num2 = round(num2) print(rounded_num1) # Output: 4 print(rounded_num2) # Output: 9
💡Key Conceptual Anchor:Python Built In Functions
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the built-in function max() do in Python?
Correct Answer: Option A — Returns the largest item in an iterable
Detailed Academic Explanation:
The correct answer is Option A: Returns the largest item in an iterable . The max() function in Python is used to find the largest item in an iterable, such as a list, tuple, or set. It takes one or more arguments and returns the largest item. For example: numbers = [5, 2, 8, 1, 6] largest_number = max(numbers) print(largest_number) # Output: 8
💡Key Conceptual Anchor:Python Built In Functions
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which built-in function is used to check if all elements in an iterable are true?
Correct Answer: Option A — all()
Detailed Academic Explanation:
The correct answer is Option A: all() . The all() function in Python is used to check if all elements in an iterable are true. It takes an iterable as an argument and returns True if all elements in the iterable are true, otherwise False . For example: my_list = [True, True, True] result = all(my_list) print(result) # Output: True
💡Key Conceptual Anchor:Python Built In Functions
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the built-in function enumerate() do in Python?
Correct Answer: Option A — Returns an enumerate object that produces pairs of index and value
Detailed Academic Explanation:
The correct answer is Option A: Returns an enumerate object that produces pairs of index and value . The enumerate() function in Python is used to iterate over a sequence while keeping track of the index of each item. It takes an iterable as an argument and returns an enumerate object that produces tuples containing the index and value of each item in the iterable. For example: my_list = ['a', 'b', 'c'] for index, value in enumerate(my_list): print(index, value) # Output: # 0 a # 1 b # 2 c
💡Key Conceptual Anchor:Python Built In Functions
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which built-in function is used to convert a value to an integer?
Correct Answer: Option A — int()
Detailed Academic Explanation:
The correct answer is Option A: int() . The int() function in Python is used to convert a value to an integer. It can convert a string representing a number, a float, or even another integer to an integer data type. For example: num_str = "10" num_float = 3.14 converted_str = int(num_str) converted_float = int(num_float) print(converted_str) # Output: 10 print(converted_float) # Output: 3
💡Key Conceptual Anchor:Python Built In Functions
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the built-in function bool() do in Python?
Correct Answer: Option A — Converts a value to a boolean value
Detailed Academic Explanation:
The correct answer is Option A: Converts a value to a boolean value . The bool() function in Python is used to convert a value to a boolean value. It returns True if the value is true, and False if the value is false. For example: print(bool(0)) # Output: False print(bool(10)) # Output: True print(bool([])) # Output: False print(bool([1,2])) # Output: True
💡Key Conceptual Anchor:Python Built In Functions
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which built-in function is used to calculate the absolute value of a number?
Correct Answer: Option A — abs()
Detailed Academic Explanation:
The correct answer is Option A: abs() . The abs() function in Python is used to calculate the absolute value of a number. It returns the magnitude of a numeric value without regard to its sign. For example: print(abs(-5)) # Output: 5 print(abs(3.14)) # Output: 3.14
💡Key Conceptual Anchor:Python Built In Functions
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the built-in function dir()?
Correct Answer: Option A — Returns a list of attributes and methods of an object
Detailed Academic Explanation:
The correct answer is Option A: Returns a list of attributes and methods of an object . The dir() function in Python is used to return a list of attributes and methods of an object. When called without an argument, it returns the list of names in the current local scope. For example: my_list = [1, 2, 3] print(dir(my_list)) # Output: ['__add__', '__class__', '__contains__', ...]
💡Key Conceptual Anchor:Python Built In Functions
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the following code: my_string = "Hello, World!" print(my_string.upper())
Correct Answer: Option A — "HELLO, WORLD!"
Detailed Academic Explanation:
The correct answer is Option A: "HELLO, WORLD!" . The upper() method in Python is used to convert all the characters in a string to uppercase. So, when you call upper() on the string "Hello, World!", it converts all the letters to uppercase. my_string = "Hello, World!" print(my_string.upper()) # Output: "HELLO, WORLD!"
💡Key Conceptual Anchor:Python Built In Functions
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? any([2>8, 4>2, 1>2])
Correct Answer: Option B — True
Detailed Academic Explanation:
The any() function in Python returns True if at least one element of the iterable is true, otherwise it returns False . In the provided code, the list [2>8, 4>2, 1>2] contains three boolean expressions: 2>8 evaluates to False . 4>2 evaluates to True . 1>2 evaluates to False . Since at least one of the expressions (4>2) is true, the any() function returns True .
💡Key Conceptual Anchor:Python Built In Functions
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The function divmod(a,b), where both 'a' and 'b' are integers is evaluated as:
Correct Answer: Option B — (a//b, a%b)
Detailed Academic Explanation:
The correct answer is Option B: (a//b, a%b) . The divmod() function in Python returns a tuple containing the quotient and remainder when dividing 'a' by 'b', where both 'a' and 'b' are integers. So, when evaluated, it returns (a//b, a%b), where 'a//b' represents the quotient and 'a%b' represents the remainder.
💡Key Conceptual Anchor:Python Built In Functions
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the built-in function hex() do in Python?
Correct Answer: Option A — Converts an integer to a hexadecimal string
Detailed Academic Explanation:
The correct answer is Option A: Converts an integer to a hexadecimal string . The hex() function in Python is used to convert an integer to a lowercase hexadecimal string. For example: print(hex(15)) # Output: '0xf' print(hex(255)) # Output: '0xff'
💡Key Conceptual Anchor:Python Built In Functions
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the following code: my_list = [True, False, True] print(any(my_list))
Correct Answer: Option A — TRUE
Detailed Academic Explanation:
The any() function in Python returns True if at least one element of the iterable is true, otherwise it returns False . In the provided code, the list [True, False, True] contains at least one True value, so the any() function returns True .
💡Key Conceptual Anchor:Python Built In Functions
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python expression? round(4.5676,2)?
Correct Answer: Option C — 4.57
Detailed Academic Explanation:
The correct answer is Option C: 4.57 . The round() function in Python is used to round a floating-point number to a specified number of decimal places. When you call round(4.5676, 2) , it rounds the number 4.5676 to 2 decimal places, resulting in 4.57.
💡Key Conceptual Anchor:Python Built In Functions
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? float(‘-infinity’) float(‘inf’)
Correct Answer: Option A — -inf inf
Detailed Academic Explanation:
The float() function in Python is used to convert a string or a number to a floating-point number. When you pass the string 'inf' to the float() function, it returns positive infinity. When you pass the string '-infinity' to the float() function, it returns negative infinity.
💡Key Conceptual Anchor:Python Built In Functions
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? all(3,0,4.2)
Correct Answer: Option C — Error
Detailed Academic Explanation:
The correct answer is Option C: Error . The all() function in Python expects a single iterable as its argument, but in the provided code, it is given multiple arguments (3, 0, and 4.2) instead of a single iterable. This will raise a TypeError.
💡Key Conceptual Anchor:Python Built In Functions
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the function complex()?
Correct Answer: Option B — 0+0j
Detailed Academic Explanation:
The correct answer is Option B: 0+0j . The complex() function in Python is used to create a complex number. When no arguments are passed, it returns 0 as the real and imaginary parts, resulting in the complex number 0+0j.
💡Key Conceptual Anchor:Python Built In Functions
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? oct(7) oct(‘7’)
Correct Answer: Option C — 0o7 Error
Detailed Academic Explanation:
The oct() function in Python converts an integer to an octal string. When passed an integer argument, it returns the octal representation prefixed with '0o'. However, when passed a string argument, it tries to convert the string to an integer first, and if it fails, it raises a ValueError. Therefore, the first call to oct(7) returns '0o7', while the second call to oct('7') raises an error.
💡Key Conceptual Anchor:Python Built In Functions
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the following code: my_list = [1, 2, 3, 4] print(sum(my_list))
Correct Answer: Option A — 10
Detailed Academic Explanation:
The correct answer is Option A: 10 . The sum() function in Python is used to sum up all the values in an iterable, such as a list. When you pass the list [1, 2, 3, 4] to the sum() function, it adds up all the elements in the list and returns the total sum, which is 10.
💡Key Conceptual Anchor:Python Built In Functions
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python functions? chr(‘97’) chr(97)
Correct Answer: Option C — Error a
Detailed Academic Explanation:
For the first call chr('97'), the function chr() expects an integer representing a Unicode code point, not a string. When it receives the string '97', it attempts to convert it to an integer, but it raises a TypeError because it cannot directly convert a string to an integer in this context. Hence, it results in an error. For the second call chr(97), the argument passed is an integer, which represents the Unicode code point for the character 'a'. Therefore, this call to chr() returns the character 'a'. So, the output is "Error" for the first call and "a" for the second call.
💡Key Conceptual Anchor:Python Built In Functions
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the following code: my_list = [5, 8, 2, 6] print(max(my_list))
Correct Answer: Option A — 8
Detailed Academic Explanation:
The correct answer is Option A: 8 . The max() function in Python is used to find the maximum value among the elements of an iterable, such as a list. When you pass the list [5, 8, 2, 6] to the max() function, it returns the maximum value from the list, which is 8.
💡Key Conceptual Anchor:Python Built In Functions
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following code: my_string = " Hello, World! " print(my_string.strip())
Correct Answer: Option A — "Hello, World!"
Detailed Academic Explanation:
The correct answer is Option A: "Hello, World!" . The strip() function in Python is used to remove leading and trailing whitespace (spaces, tabs, and newline characters) from a string. When you call strip() on the string " Hello, World! ", it removes the leading and trailing spaces and returns the modified string "Hello, World!".
💡Key Conceptual Anchor:Python Built In Functions
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following code: my_string = "Hello, World!" print(my_string.lower())
Correct Answer: Option A — "hello, world!"
Detailed Academic Explanation:
The correct answer is Option A: "hello, world!" . The lower() function in Python is used to convert all characters in a string to lowercase. When you call lower() on the string "Hello, World!", it converts all uppercase letters to lowercase, resulting in the string "hello, world!".
💡Key Conceptual Anchor:Python Built In Functions
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? complex(1+2j)
Correct Answer: Option D — 1+2j
Detailed Academic Explanation:
The correct answer is Option D: 1+2j . The complex() function in Python is used to create a complex number from real and imaginary parts. When you pass the expression 1+2j to the complex() function, it returns the complex number with real part 1 and imaginary part 2j.
💡Key Conceptual Anchor:Python Built In Functions
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which built-in function is used to convert a value to a string?
Correct Answer: Option A — str()
Detailed Academic Explanation:
The correct answer is Option A: str() . The str() function in Python is used to convert a value to a string. It can convert various types of values, such as integers, floats, booleans, and even other data structures like lists and dictionaries, into their string representations. For example: x = 10 y = 3.14 z = True str_x = str(x) str_y = str(y) str_z = str(z) print(str_x) # Output: '10' print(str_y) # Output: '3.14' print(str_z) # Output: 'True'
💡Key Conceptual Anchor:Python Built In Functions
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the built-in function type() do in Python?
Correct Answer: Option A — Returns the type of an object
Detailed Academic Explanation:
The correct answer is Option A: Returns the type of an object . The type() function in Python is used to get the type of an object. It returns the type of the object passed as an argument. This can be useful for checking the type of variables or objects during runtime. For example: x = 10 y = "Hello" z = [1, 2, 3] print(type(x)) # Output: print(type(y)) # Output: print(type(z)) # Output:
💡Key Conceptual Anchor:Python Built In Functions
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? float(' -12345\n') (Note that the number of blank spaces before the number is 5)
Correct Answer: Option B — -12345.0
Detailed Academic Explanation:
The correct answer is Option B: -12345.0 . The float() function in Python is used to convert a string or a number to a floating-point number. When you pass the string ' -12345\n' (which includes leading and trailing whitespace characters) to the float() function, it strips the leading and trailing whitespace and converts the remaining characters to a floating-point number. In this case, it converts '-12345' to a float, resulting in -12345.0.
💡Key Conceptual Anchor:Python Built In Functions
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following functions does not throw an error?
Correct Answer: Option B — ord(' ')
Detailed Academic Explanation:
The correct answer is Option B: ord(' ') . The ord() function in Python is used to get the Unicode code point of a character. When you pass a single character as an argument to the ord() function, it returns the Unicode code point of that character. In this case, passing a space character (' ') to the ord() function will not throw an error, as it represents a valid Unicode character. It returns the Unicode code point for the space character, which is 32. The other options will result in errors: Option A: ord() without any argument throws a TypeError because it requires exactly one argument. Option C: ord(") throws a TypeError because it's missing the character argument. Option D: ord("") throws a TypeError because it's passing an empty string as an argument, which is invalid.
💡Key Conceptual Anchor:Python Built In Functions
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the following code: my_list = [3, 1, 4, 1] print(sorted(my_list))
Correct Answer: Option A — [1, 1, 3, 4]
Detailed Academic Explanation:
The correct answer is Option A: [1, 1, 3, 4] . The sorted() function in Python is used to sort the elements of an iterable in ascending order. When you pass the list [3, 1, 4, 1] to the sorted() function, it sorts the elements and returns a new list with the elements sorted in ascending order. Therefore, the output will be [1, 1, 3, 4].
💡Key Conceptual Anchor:Python Built In Functions
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following functions does not necessarily accept only iterables as arguments?
Correct Answer: Option C — chr()
Detailed Academic Explanation:
The correct answer is Option C: chr() . The chr() function in Python converts a Unicode code point into its corresponding character. While it typically takes an integer representing a Unicode code point as its argument, it does not necessarily accept only iterables. Instead, it can accept a wide range of integer values representing Unicode code points as arguments. The other options: Option A: enumerate() typically accepts iterables as arguments, as it is used to iterate over them while providing an index. Option B: all() typically accepts iterables as arguments, as it checks if all elements in the iterable evaluate to True. Option D: max() typically accepts iterables as arguments, as it returns the maximum element from the iterable.
💡Key Conceptual Anchor:Python Built In Functions
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output of the following code: my_list = [1, 2, 3] print(list(reversed(my_list)))
Correct Answer: Option A — [3, 2, 1]
Detailed Academic Explanation:
The correct answer is Option A: [3, 2, 1] . The reversed() function in Python is used to reverse the elements of an iterable. When you pass the list [1, 2, 3] to the reversed() function and then convert the result to a list using list(), it returns a new list with the elements reversed, resulting in [3, 2, 1].
💡Key Conceptual Anchor:Python Built In Functions
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python functions? float('1e-003') float('2e+003')
Correct Answer: Option B — 0.001 2000.0
Detailed Academic Explanation:
Option B: 0.001 2000.0 When the strings '1e-003' and '2e+003' are passed to the float() function, they are interpreted as scientific notation representing floating-point numbers. '1e-003' represents 1×10 −3 which is equal to 0.001. '2e+003' represents 2×10 3 which is equal to 2000.0. Therefore, the output will be 0.001 and 2000.0.
💡Key Conceptual Anchor:Python Built In Functions
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? ord(65) ord(‘A’)
Correct Answer: Option B — Error 65
Detailed Academic Explanation:
Option B: Error 65 When the argument '65' is passed to the ord() function, it's treated as an integer and not a valid Unicode character. Therefore, the function will not raise an error. Instead, it will return the Unicode code point of the character corresponding to the integer 65, which is 'A'. Hence, the correct answer is indeed Option B: Error 65.
💡Key Conceptual Anchor:Python Built In Functions
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the built-in function chr() do in Python?
Correct Answer: Option A — Returns a string representing a character whose Unicode code point is the integer
Detailed Academic Explanation:
The correct answer is Option A: Returns a string representing a character whose Unicode code point is the integer . The chr() function in Python is used to return a string representing a character whose Unicode code point is the integer passed as an argument. For example, chr(65) returns the string 'A' because the Unicode code point of the character 'A' is 65. Therefore, the function converts integer Unicode code points to their corresponding characters.
💡Key Conceptual Anchor:Python Built In Functions
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? list(enumerate([2, 3]))
Correct Answer: Option C — [(0, 2), (1, 3)]
Detailed Academic Explanation:
The correct answer is Option C: [(0, 2), (1, 3)] . The enumerate() function in Python is used to add a counter to an iterable and return it as an enumerate object. When the enumerate object is converted to a list using the list() function, it returns a list of tuples where each tuple contains the index and the corresponding element of the original iterable. In this case, the input list is [2,3][2,3], and its elements are indexed starting from 0. Therefore, the output will be [(0,2),(1,3)][(0,2),(1,3)].
💡Key Conceptual Anchor:Python Built In Functions
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which built-in function is used to calculate the length of a sequence like a list or string?
Correct Answer: Option A — len()
Detailed Academic Explanation:
The correct answer is Option A: len() . The len() function in Python is used to calculate the length of a sequence, such as a list or a string. It returns the number of items in the sequence. For example, len([1, 2, 3]) will return 3, as there are three elements in the list. Similarly, len("hello") will return 5, as there are five characters in the string "hello".
💡Key Conceptual Anchor:Python Built In Functions
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python function? all([2,4,0,6])
Correct Answer: Option C — False
Detailed Academic Explanation:
The correct answer is Option C: False . The all() function in Python returns True if all elements of the iterable are true, and False otherwise. In this case, the iterable is [2,4,0,6][2,4,0,6]. Since the element 0 evaluates to False in a Boolean context, the function will return False. Therefore, the output of the function call all([2, 4, 0, 6]) will be False.
💡Key Conceptual Anchor:Python Built In Functions
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Python functions? x=3 eval('x^2')
Correct Answer: Option B — 1
Detailed Academic Explanation:
The eval() function in Python evaluates the specified expression, which is a string, and returns the result. In this case, the expression 'x^2' is evaluated. However, the ^ operator in Python represents bitwise XOR, not exponentiation. So, 'x^2' evaluates to 3⊕2=6 in bitwise XOR. Therefore, the output of the function call eval('x^2') will be 6.
💡Key Conceptual Anchor:Python Built In Functions
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the built-in function ord()?
Correct Answer: Option A — Returns the Unicode code point of a character
Detailed Academic Explanation:
The correct answer is Option A: Returns the Unicode code point of a character . The ord() function in Python is used to return the Unicode code point of a character. Unicode is a standard for encoding characters and assigning a unique number to each character. When you pass a character to the ord() function, it returns the Unicode code point of that character, which is essentially an integer representing the character in Unicode.
💡Key Conceptual Anchor:Python Built In Functions
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.