0% found this document useful (0 votes)
645 views

Assertion Reasoning Questions- Python

The document contains a series of assertion and reasoning questions related to Python programming concepts. Each question presents an assertion and a reasoning statement, with multiple choice answers indicating the truth of both statements. The document also includes the correct answers for each question.

Uploaded by

Manan
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)
645 views

Assertion Reasoning Questions- Python

The document contains a series of assertion and reasoning questions related to Python programming concepts. Each question presents an assertion and a reasoning statement, with multiple choice answers indicating the truth of both statements. The document also includes the correct answers for each question.

Uploaded by

Manan
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/ 4

QB/XII/CS-083/2025/Questions

Python Assertion Reasoning based Questions


Following are Assertion(A) and Reasoning(R) based questions. Mark the correct choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is False but R is True
1. Assertion (A): print is an invalid variable name.
Reasoning (R): Keywords cannot be used as variable names.
2. Assertion (A): if is an invalid variable name
Reasoning (R): keywords cannot be used as variable names
3. Assertion (A): 5Trillion is a valid variable name
Reasoning (R): 5Trillion is not a keyword
4. Assertion (A): x-y is a valid variable name
Reasoning (R): A variable name can start with an alphabet
5. Assertion (A): An inbuilt identifier can be redefined.
Reasoning (R): An inbuilt identifier is not a keyword.
6. Assertion (A): An inbuilt identifier cannot be redefined
Reasoning (R): Keywords cannot be redefined
7. Assertion (A): eval(5*4) is an invalid expression
Reasoning (R): eval() takes only a string as a parameter
8. Assertion (A): eval('3'*4) is a valid expression
Reasoning (R): An expression using eval()is always valid.
9. Assertion (A): eval('3')*'4' is an invalid expression
Reasoning (R): We cannot multiply two strings.
10. Assertion (A): eval('3')*4 is a valid expression
Reasoning (R): A string can be multiplied with an integer
11. Assertion (A): eval('3')*'K' is a valid expression
B: A string can be multiplied with an integer
12. Assertion (A): int(12.5) returns 12
Reasoning (R): int() returns integer part of its numeric parameter
13. Assertion (A): int('12.5') returns 12
Reasoning (R): int() returns integer part of its numeric parameter
14. Assertion (A): int(12+3.5) returns 15
Reasoning (R): int() returns integer part of its numeric parameter
15. Assertion (A): int('12+3') returns 15
Reasoning (R): int() returns integer part of its numeric parameter
16. Assertion (A): int('12+3') raises an exception (run-time error)
Reasoning (R): string parameter of int() function should represent a valid integer only.
17. Assertion (A): If a=(5/4) then datatype of a is float.
Reasoning (R): / (real division operator) always returns a float value.
18. Assertion (A): If a=(5//4) then datatype of a is int.
Reasoning (R): // (floor division operator) always returns an integer value.
19. Assertion (A): Sometimes fractional number calculation does not give exact result.
Reasoning (R): Some fractional numbers do not have exact binary representation.
20. Assertion (A): if a in b is a valid expression in Python, then b can be a list.
Reasoning (R): in is an operator must in Python.
21. Assertion (A): if a in b is a valid expression in Python, then b can be a list.
Reasoning (R): The second operand of in can be any iterable.

www.yogeshsir.com Page: 1/4 www.youtube.com/LearnWithYK


QB/XII/CS-083/2025/Questions

22. Assertion (A): ('a' and 'b' or not 5) is a valid expression in Python.
Reasoning (R): In Python, strings and numbers can be treated as Boolean values.
23. Assertion (A): eval('3.3')*3 is a valid expression in Python .
Reasoning (R): * works as replication operator between a string and an integer.
24. Assertion (A): If L is a list, then L+=range(5) is an invalid statement.
Reason (R): Only a list can be concatenated to a list.
25. Assertion (A): We cannot delete an element from a tuple.
Reasoning (R): tuples are immutable data objects.
26. Assertion (A): A tuple can be concatenated to a list, but a list cannot be concatenated to a tuple.
Reason (R): Lists are mutable and tuples are immutable in Python.
27. Assertion (A): 'Amitabh' > 'Ajit'
Reasoning: Strings of bigger length are greater than strings of smaller length
28. Assertion (A): 'Amitabh' > 'Ajit'
Reasoning: Unicode/ASCII value of 'm' is greater than that of 'j'.
29. s="Alpha"+"Beta"
Assertion (A): Value of s will be "AlphaBeta".
Reasoning (R): Operator '+' adds the operands, if both are numbers & concatenates the operands if both are
strings.
30. Assertion (A): In Python, elements of a string can be accessed using index numbers.
Reasoning (R): Strings are sequences in Python.
31. Assertion (A): Elements of a sequence can always be accessed using index numbers.
Reasoning (R): All iterables are sequences in Python.
32. Assertion (A): All iterables are sequences in Python.
Reasoning (R): Elements of a sequence can be accessed using index numbers.
33. Assertion (A): The number of actual parameters in a function call may not be equal to the number of formal
parameters of the function.
Reasoning (R): During a function call, it is optional to pass the values to default parameters.
34. Assertion (A): [1,2,3] is an invalid key for a dictionary in Python.
Reason (R): Only numbers and strings can be the keys of a dictionary in Python.
35. Assertion (A): 2 in {'a':1, 'b':2, 'c':3} is True
Reasoning (B): 2 is value in the dictionary.
36. Assertion (A): 2 in {'a':1, 'b':2, 'c':3} is False
Reasoning (B): 2 is a key present in the dictionary.
37. Assertion (A): 2 in {'a':1, 'b':2, 'c':3} is False
Reasoning (B): 2 is a value present in the dictionary.
38. Assertion (A): 2 in {'a':1, 'b':2, 'c':3} is False
Reasoning (B): 2 is not a key in the dictionary.
39. Assertion (A) : Keys in a Python dictionary should be unique.
Reasoning (R) : Only immutable data types can be used as keys.
40. Assertion (A): print(f1()) is a valid statement even if the function f1() has no return statement.
Reasoning (R): A function always returns a value even if it has no return statement.
41. Assertion (A): A variable declared as global inside a function is visible outside the function only after the
function is called.
Reasoning (R): All variables declared outside are not visible inside a function till they are redeclared with global
keyword.
42. Assertion (A): If the arguments in a function call statement match the number and order of arguments as defined
in the function definition, such arguments are called positional arguments.
Reasoning (R): During a function call, the argument list first contains keyword argument(s) followed by
positional argument(s).

www.yogeshsir.com Page: 2/4 www.youtube.com/LearnWithYK


QB/XII/CS-083/2025/Questions

43. Assertion (A): In Python, the statement return [<expression>] exits a function.
Reasoning (R): return statement transfers the control to the caller. A return statement with no arguments is the
same as return None.
44. Assertion (A):- keyword arguments are related to the function calls.
Reasoning (R):- when you use keyword arguments in a function call, the caller identifies the arguments by
parameter name.
45. Assertion (A): The default value of an argument will be used inside a function if we do not pass a value to that
argument at the time of the function call.
Reasoning (R): the default arguments are optional during the function call.
46. Assertion (A): Built in functions are predefined in the language that are used directly.
Reasoning(R): print() and input() are built in functions in Python.
47. Assertion (A):- The default arguments can be skipped in the function call.
Reasoning (R):- The function argument will take the default values even if the values are supplied in the function
call.
48. Assertion (A): The function definition def calculate(a, b,c=1,d): will give error.
Reasoning (R): All the non-default arguments must precede the default arguments.
49. Assertion (A): A function in Python always returns a value.
Reasoning (R): return statement is optional in Python.
50. Assertion (A): We cannot redefine an inbuilt function in Python.
Reasoning (R): Keywords cannot be redefined in Python.
51. Assertion (A): If a text file already containing some text is opened in write mode the previous contents are
overwritten.
Reasoning (R): When a file is opened in write mode the file pointer is present at the beginning position of the
file.
52. Assertion (A): If a text file is opened in 'a+' mode, then we can write the data anywhere in the file.
Reasoning (R): seek() method can be used to place the pointer anywhere in a file.
53. Assertion (A): seek() method can be used instead of tell() method.
Reasoning (R): seek(0) returns the value of file pointer without changing it.
54. Assertion (A): We can use any string, instead of a comma, as a delimiter of a csv file.
Reasoning (R): Comma is the default delimiter of a csv file.
55. Assertion (A): CSV (Comma Separated Values) is a file format for data storage which looks like a text file.
Reasoning (R): In a CSV file the information is organized with one record on each line and each field is separated
by semi-colon.
56. Assertion (A): CSV module allows to write a single record in each row in a CSV file using the writerow()
function.
Reasoning (R): writerow() function creates header row in csv file by default.
57. Assertion (A): CSV stands for Comma Separated Values.
Reasoning (R): CSV files are a common file format for transferring and storing data.
58. Assertion (A): Pickling is the process by which a Python object is converted to a byte stream.
Reasoning (R): load() method is used to write the objects in a binary file. dump() method is used to read
data from a binary file.
59. Assertion (A): If only strings are written to a binary file, then it can be treated as a text file.
Reasoning (R): Pickling and unpickling can be done for strings also.
60. Assertion (A): A binary file in python can be used to store any kind of objects that can be later retrieved in their
original form using pickle module.
Reasoning (R): Binary files are just like normal text files and can be read using a text editor like notepad.

www.yogeshsir.com Page: 3/4 www.youtube.com/LearnWithYK


QB/XII/CS-083/2025/Questions

Answers - Assertion Reasoning based Questions


1. D 2. A 3. D 4. D 5. A 6. D 7. A 8. C 9. D 10. B
11. A 12. A 13. D 14. D 15. D 16. A 17. A 18. C 19. A 20. B
21. A 22. A 23. B 24. D 25. A 26. D 27. C 28. A 29. A 30. A
31. B 32. B 33. A 34. C 35. D 36. C 37. B 38. A 39. B 40. A
41. C 42. C 43. A 44. B 45. A 46. B 47. C 48. A 49. B 50. B
51. B 52. D 53. A 54. D 55. A 56. D 57. B 58. C 59. D 60. C

www.yogeshsir.com Page: 4/4 www.youtube.com/LearnWithYK

You might also like