0% found this document useful (0 votes)
26 views11 pages

50 Python Boolean, List MCQS

Uploaded by

dkevinharris2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views11 pages

50 Python Boolean, List MCQS

Uploaded by

dkevinharris2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

l

ita
Boolean Logic (15 Questions)

1.​ Which of the following is NOT a Boolean value in Python?​


a) True​


b) False​
c) None
d) 1

ig
2.​ What is the default Boolean value of an empty list in Python?​
a) True​

ad
b) False ​
c) None​
d) Error
3.​ Which of the following operators is used for logical AND in Python?​


a) &&​
b) and ​
ith

c) &​
d) &&&
4.​ In Python, what will not True evaluate to?​
a) False✅ ​
b) True​
an

c) None​
d) Error
5.​ Which Boolean operator returns True if at least one operand is True?​


a) and​
b) or ​
c) not​
d) xor
6.​ What is the result of False or False?​


a) True​
b) False ​

1
c) None​
d) Error
7.​ Which of the following statements is True?​
a) Boolean values are case-sensitive in Python​


b) The integer 0 is equivalent to True in Python​
c) True and False are keywords in Python

l

ita
d) None is equivalent to False


8.​ What is the Boolean value of a non-empty string?​
a) True ​
b) False​
c) None​
d) Error

a) Reverse the truth value


b) Perform bitwise operations​

ig
9.​ The not operator in Python is used to:​

ad
c) Compare two values​
d) Check for equality
10.​What is the result of True and False?​
a) False ✅ ​
b) True​
c) None​
ith

d) Error
11.​Which operator has the highest precedence in Boolean logic?​
a) and​


b) or​
c) not ​
an

d) all have the same precedence


12.​Which of the following values will evaluate to False?​


a) "False"​
b) 0 ​
c) [1, 2, 3]​
d) 1
13.​Which statement is incorrect regarding Boolean values?​
a) bool(0) is False​
b) bool([]) is False​

2
c) bool(None) is True ✅​
d) bool('') is False
14.​What is the output of bool(100)?​
a) True✅ ​
b) False​

l
c) None​

ita
d) 100
15.​Which Boolean expression evaluates to True?​
a) not (True and False)​
b) True or False ✅​
c) False and True​
d) False and False

ig
ad
ith

Loops (15 Questions)


16.​Which type of loop is used when the number of iterations is known?​
a) for loop ​
b) while loop​
an

c) infinite loop​
d) do-while loop


17.​Which statement is used to exit a loop?​
a) break ​
b) continue​
c) pass​
d) exit
18.​Which loop will execute at least once, even if the condition is False?​


a) for loop​
b) do-while loop (not in Python) ​

3
c) while loop​
d) infinite loop
19.​What does the continue statement do in a loop?​


a) Exits the loop​
b) Skips the current iteration and moves to the next ​

l
c) Repeats the same iteration​

ita
d) Stops execution of the program


20.​What will happen if the condition in a while loop is always True?​
a) Infinite loop ​
b) Syntax error​
c) No execution​
d) Executes once

a) for loop​
b) while loop
c) do-while loop​
​ ig
21.​Which loop is preferred when the number of iterations is unknown?​


ad
d) nested loop
22.​Which keyword is used to define a loop in Python?​


a) repeat​
b) for ​
c) iterate​
ith

d) do
23.​Which keyword is used to skip the rest of the code inside a loop for the current


iteration?​
a) continue ​
b) break​
an

c) skip​
d) pass
24.​Which statement is used to create an empty loop in Python?​
a) break​


b) continue​
c) pass ​
d) None
25.​What is the output of range(5)?​


a) [1, 2, 3, 4, 5]​
b) [0, 1, 2, 3, 4] ​

4
c) [5, 4, 3, 2, 1]​
d) Error

l
ita
ig
ad
ith
an

5
Lists & List Processing (20 Questions)


26.​What is a list in Python?​
a) An ordered collection of elements ​
b) A single value variable​
c) A function​

l
d) A keyword

ita

27.​Which symbol is used to define a list?​
a) [] ​
b) {}​
c) ()​
d) <>

a) append()✅
b) insert()​
c) add()​

ig
28.​Which method is used to add an element at the end of a list?​
ad
d) extend()


29.​Which function returns the number of elements in a list?​
a) len() ​
b) size()​
c) count()​
ith

d) length()
30.​Which of the following is NOT a valid list method?​
a) pop()​


b) append()​
c) push() ​
an

d) insert()


31.​How are list elements accessed?​
a) Using index numbers ​
b) Using keys​
c) Using brackets​
d) Automatically


32.​Which list method removes the last item by default?​
a) pop() ​
b) remove()​
c) discard()​
d) delete()

6

33.​Which list method sorts a list in ascending order?​
a) sort() ​
b) order()​
c) arrange()​
d) sorted()


34.​Which function returns a copy of a list?​

l
a) copy() ​

ita
b) duplicate()​
c) list()​
d) clone()


35.​Which method removes all elements from a list?​
a) clear() ​
b) removeAll()​
c) delete()​
d) reset()
ig
36.​What happens if you try to access an index that does not exist in a list?​
ad

a) Returns None​
b) Raises an IndexError ​
c) Returns an empty list​
d) Ignores the operation


37.​Which method removes a specific element from a list?​
ith

a) remove() ​
b) pop()​
c) discard()​
d) delete()
38.​What is the result of list(range(3))?​
an


a) [1, 2, 3]​
b) [0, 1, 2] ​
c) [0, 1, 2, 3]​
d) [1, 2]


39.​What is the default step size when using slicing on a list?​
a) 1 ​
b) 0​
c) -1​
d) 2


40.​Which method returns the index of a specific element in a list?​
a) index() ​

7
b) find()​
c) search()​
d) locate()
41.​What is the output of len([])?​

a) 0 ​

l
b) 1​

ita
c) None​
d) Error


42.​Which of the following statements is True about Python lists?​
a) Lists can contain elements of different data types ​
b) Lists must have elements of the same type​
c) Lists are immutable​
d) Lists cannot be nested

a) append()​


b) insert()​
ig
43.​Which method is used to merge two lists?​
ad
c) extend() ​
d) merge()
44.​Which operator is used to repeat list elements multiple times?​


a) +​
b) * ​
ith

c) /​
d) -
45.​What happens when you use the sort() method on a list?​

a) It sorts the list in ascending order by default ​
b) It creates a new sorted list​
an

c) It removes duplicate values​


d) It reverses the list


46.​Which method is used to insert an element at a specific position in a list?​
a) insert() ​
b) append()​
c) push()​
d) add()


47.​How do you check if an item exists in a list?​
a) Using the in operator ​
b) Using the find() method​

8
c) Using list.contains()​
d) Using check()


48.​Which of the following creates an empty list?​
a) [] ​
b) {}​

l
c) ()​

ita
d) empty[]
49.​Which of the following list operations is invalid?​
a) Concatenation using +​
b) Multiplication using / ✅​
c) Repetition using *​
d) Membership checking using in

✅ ig
50.​What is the time complexity of accessing an element in a list by index?​
a) O(1)
b) O(n)​

ad
c) O(log n)​
d) O(n^2)
ith
an

9
an
ith
ad
ig
ita
l

10

You might also like