Computational Thinking and Programming-I Quiz 5

๐Ÿ” Computational Thinking & Programming-I Quiz 5 โ€” Expressions, Type Conversion & I/O (Class 11 CS)

Practice 20 CBSE Class 11 Computer Science (Code 083) MCQs on expressions, statements, type conversion, and input/output โ€” operator precedence, expression evaluation, explicit & implicit type conversion, and accepting/displaying data with input() and print().

Every expression and function result below has been verified by actually running it in Python. Tap any question to reveal the answer with a clear explanation.

๐Ÿ”ข Precedence๐Ÿงฎ Expressions๐Ÿ” Type ConversionโŒจ๏ธ Input/Output
Q1
๐Ÿ”ข Precedence

What is the precedence of operators in Python?

  1. Operators are evaluated from left to right
  2. Operators are evaluated from right to left
  3. Operators have equal precedence
  4. Operators have different precedence levels
Show Answer & Explanation

โœ… Answer: (d) Operators have different precedence levels

Python operators have different precedence levels โ€” for example, ** (exponent) is evaluated before * and /, which in turn are evaluated before + and -. Left-to-right evaluation only applies within operators of the same precedence level.

Q2
๐Ÿงฎ Expressions

Which of the following is an expression in Python?

  1. for i in range(5):
  2. x = 10
  3. print(โ€œHello, World!โ€)
  4. 5 + 3 * 2
Show Answer & Explanation

โœ… Answer: (d) 5 + 3 * 2

5 + 3 * 2 is a pure expression โ€” it combines values and operators to produce a single result (14) without any keyword or side effect. for ...: and x = 10 are statements, and while print() is technically a function call, it’s typically used as a statement performing an action rather than being valued for its result.

Q3
๐Ÿงฎ Expressions

How are expressions evaluated in Python?

  1. From left to right
  2. From right to left
  3. Based on operator precedence
  4. Randomly
Show Answer & Explanation

โœ… Answer: (c) Based on operator precedence

Expressions are evaluated based on operator precedence โ€” higher-precedence operators (like ** or those inside parentheses) are resolved before lower-precedence ones, regardless of their position in the expression.

Q4
๐Ÿ” Type Conversion

What is type conversion in Python?

  1. Assigning a value to a variable
  2. Combining multiple values into a single value
  3. Converting one data type to another
  4. Evaluating an expression
Show Answer & Explanation

โœ… Answer: (c) Converting one data type to another

Type conversion means changing a value from one data type to another โ€” for example, turning the string "10" into the integer 10.

Q5
๐Ÿ” Type Conversion

What is explicit type conversion in Python?

  1. Automatic conversion of data types
  2. Conversion of data types without specifying the target type
  3. Conversion of data types using built-in functions or methods
  4. Conversion of data types by Python interpreter
Show Answer & Explanation

โœ… Answer: (c) Conversion of data types using built-in functions or methods

Explicit type conversion (also called type casting) happens when the programmer deliberately calls a built-in function like int(), float(), or str() to convert a value.

Q6
๐Ÿ” Type Conversion

What is implicit type conversion in Python?

  1. Automatic conversion of data types
  2. Conversion of data types without specifying the target type
  3. Conversion of data types using built-in functions or methods
  4. Conversion of data types by Python interpreter
Show Answer & Explanation

โœ… Answer: (a) Automatic conversion of data types

Implicit conversion happens automatically โ€” Python converts a value’s type behind the scenes when needed, without the programmer calling any function (e.g. an int automatically becoming a float during mixed-type arithmetic).

Q7
โŒจ๏ธ Input/Output

How can you accept data as input from the console in Python?

  1. Using the print() function
  2. Using the input() function
  3. Using the type() function
  4. Using the eval() function
Show Answer & Explanation

โœ… Answer: (b) Using the input() function

input() is the built-in function used to accept data typed by the user at the console, always returning it as a string.

Q8
โŒจ๏ธ Input/Output

What is the purpose of the input() function in Python?

  1. Display output on the console
  2. Convert data types
  3. Accept data as input from the user
  4. Evaluate an expression
Show Answer & Explanation

โœ… Answer: (c) Accept data as input from the user

The input() function’s job is simply to accept data as input from the user, pausing the program until they type something and press Enter.

Q9
โŒจ๏ธ Input/Output

How do you display output on the console in Python?

  1. Using the input() function
  2. Using the eval() function
  3. Using the print() function
  4. Using the type() function
Show Answer & Explanation

โœ… Answer: (c) Using the print() function

print() is the built-in function used to display output on the console.

Q10
๐Ÿ” Type Conversion

What is the result of the expression int(โ€œ10โ€) in Python?

  1. โ€œ10โ€
  2. 10
  3. 0
  4. Error
Show Answer & Explanation

โœ… Answer: (b) 10

int("10") explicitly converts the string "10" into the actual integer 10 (no quotes โ€” it’s now a number, not text).

Q11
๐Ÿ” Type Conversion

What is the result of the expression float(5) in Python?

  1. 5
  2. 0.0
  3. 5.0
  4. Error
Show Answer & Explanation

โœ… Answer: (c) 5.0

float(5) converts the integer 5 into its floating-point equivalent: 5.0.

Q12
๐Ÿ” Type Conversion

What is the result of the expression str(42) in Python?

  1. 42
  2. โ€œ42โ€
  3. 0
  4. Error
Show Answer & Explanation

โœ… Answer: (b) โ€œ42โ€

str(42) converts the integer 42 into the string “42” โ€” shown with quotes here to indicate it’s now text, not a number.

Q13
๐Ÿ” Type Conversion

What is the result of the expression bool(0) in Python?

  1. 0
  2. False
  3. True
  4. Error
Show Answer & Explanation

โœ… Answer: (b) False

In Python, 0 is considered โ€œfalsyโ€, so bool(0) evaluates to False. Every other non-zero number converts to True.

Q14
โŒจ๏ธ Input/Output

What is the result of the expression input(โ€œEnter your name: โ€) in Python?

  1. โ€œEnter your name: โ€
  2. None
  3. The user’s input as a string
  4. Error
Show Answer & Explanation

โœ… Answer: (c) The user’s input as a string

The text inside input() is just a prompt shown to the user. The expression itself evaluates to whatever the user actually types, always returned as a string โ€” even if they type numbers.

Q15
๐Ÿ” Type Conversion

How do you convert a string to an integer in Python?

  1. Using the int() function
  2. Using the str() function
  3. Using the float() function
  4. Using the bool() function
Show Answer & Explanation

โœ… Answer: (a) Using the int() function

int() is the function to use โ€” for example, int("25") gives the integer 25. (It will raise a ValueError if the string isn’t a valid whole number.)

Q16
๐Ÿ”ข Precedence

Which of the following has the HIGHEST precedence in a Python expression?

  1. Addition (+)
  2. Multiplication (*)
  3. Exponentiation (**)
  4. Parentheses ()
Show Answer & Explanation

โœ… Answer: (d) Parentheses ()

Parentheses always have the highest precedence โ€” anything inside () is evaluated first, overriding the normal operator order. After that comes **, then *//, then +/-.

Q17
๐Ÿ” Type Conversion

What is the result of the expression 5 + 2.5 in Python?

  1. 7 (as an integer)
  2. 7.5 (as a float)
  3. Error, since int and float can’t be added
  4. “7.5” (as a string)
Show Answer & Explanation

โœ… Answer: (b) 7.5 (as a float)

This is a classic example of implicit type conversion โ€” Python automatically converts the integer 5 into a float behind the scenes so it can be added to 2.5, giving 7.5 as a float.

Q18
โŒจ๏ธ Input/Output

What does eval() do in Python?

  1. Converts a string to an integer
  2. Evaluates a string as a Python expression and returns the result
  3. Prints a value to the console
  4. Declares a new variable
Show Answer & Explanation

โœ… Answer: (b) Evaluates a string as a Python expression and returns the result

eval() takes a string containing valid Python code and evaluates it as an expression, returning the result โ€” for example, eval("3 + 4") returns 7.

Q19
โŒจ๏ธ Input/Output

What does the statement num = int(input()) do in a single line?

  1. Reads input and keeps it as a string only
  2. Reads input from the user and converts it to an integer
  3. Converts a number to a string and displays it
  4. Always raises an error
Show Answer & Explanation

โœ… Answer: (b) Reads input from the user and converts it to an integer

This combines two steps: input() reads what the user types (as a string), and int() immediately converts that string into an integer โ€” a very common pattern for accepting numeric input.

Q20
โŒจ๏ธ Input/Output

Which method is commonly used with input() to accept multiple space-separated values on a single line?

  1. split()
  2. join()
  3. format()
  4. strip()
Show Answer & Explanation

โœ… Answer: (a) split()

input().split() is the standard pattern โ€” it reads one line of input and splits it into a list of separate values wherever there’s whitespace, letting you accept multiple inputs at once.

Jitendra Singh
โœ” Verified Educator

Jitendra Singh

Founder of CBSEPython.in

I help CBSE Class 9โ€“12 students learn Python, Information Technology, Artificial Intelligence and Computer Science through easy notes, quizzes, MCQs and sample papers.

Read More About Me โ†’