Exit Chapter 04 ยท ๐Ÿ”ข Data Handling โ€” Quiz

Playing as a guest? to earn XP and track your progress.

Question 1 of 59 0 correct so far

๐Ÿ”ข Data Handling Quiz

Q1.

What is the data type of 25 in Python?

Explanation

Whole numbers without a decimal point are integers (int).

Q2.

What is the output of:

print(type(3.0))
Explanation

A number with a decimal point is a float, even if the decimal part is 0.

Q3.

2.5E3 represents which value?

Explanation

E3 means ร— 10ยณ, so 2.5E3 = 2500.0.

Q4.

Which of these is a complex number in Python?

Explanation

Python uses j for the imaginary part of a complex number.

Q5.

What is the output of:

print(True + True)
Explanation

In arithmetic, True counts as 1 and False as 0.

Q6.

Which data type has only two values, True and False?

Explanation

bool (Boolean) values are True and False.

Q7.

What is the output of:

print(type("25"))
Explanation

Anything inside quotes is a string.

Q8.

Which brackets are used to make a list?

Explanation

A list is written as [10, 20, 30].

Q9.

Which brackets are used to make a tuple?

Explanation

A tuple is written as (10, 20, 30).

Q10.

A dictionary stores data as:

Explanation

A dictionary is written as {"Riya": 92, "Aman": 78}.

Q11.

String, list and tuple are all:

Explanation

Sequences keep items in order and allow indexing from 0.

Q12.

What is the output of:

print("PYTHON"[0])
Explanation

Indexing starts at 0, so index 0 is the first character.

Q13.

What is the output of:

print(type(None))
Explanation

None has its own type, NoneType.

Q14.

Which of these is a MUTABLE type?

Explanation

Lists (and dictionaries) can be changed in place; str, tuple and int cannot.

Q15.

Which of these is an IMMUTABLE type?

Explanation

A tuple cannot be changed after it is created.

Q16.

What happens when you run:

s = "cat"
s[0] = "b"
Explanation

Strings are immutable; you cannot change a character inside one.

Q17.

What is the output of:

L = [1, 2, 3]
L[0] = 9
print(L)
Explanation

Lists are mutable, so an item can be changed.

Q18.

What is the output of:

print(7 / 2)
Explanation

/ always gives a float result.

Q19.

What is the output of:

print(7 // 2)
Explanation

// is floor division; it gives the quotient without the decimal part.

Q20.

What is the output of:

print(7 % 2)
Explanation

% gives the remainder: 7 = 2 ร— 3 + 1.

Q21.

What is the output of:

print(2 ** 3)
Explanation

** is the power operator: 2ยณ = 8.

Q22.

What is the output of:

print(10 / 5)
Explanation

/ always returns a float, even when the answer is whole.

Q23.

What is the output of:

print(-7 // 2)
Explanation

Floor division rounds DOWN, so โˆ’3.5 becomes โˆ’4.

Q24.

Which operator gives the remainder of a division?

Explanation

% is the modulus (remainder) operator.

Q25.

What is the output of:

print(10 > 5)
Explanation

10 is greater than 5, so the comparison is True.

Q26.

Which operator checks whether two values are EQUAL?

Explanation

== compares; = assigns a value.

Q27.

What is the output of:

print(5 != 5)
Explanation

!= means 'not equal to'; 5 is equal to 5, so the answer is False.

Q28.

What is the output of:

print("a" < "b")
Explanation

Strings are compared letter by letter in alphabetical (Unicode) order.

Q29.

What is the output of:

print(5 > 3 and 2 > 4)
Explanation

and is True only if BOTH sides are True; 2 > 4 is False.

Q30.

What is the output of:

print(5 > 3 or 2 > 4)
Explanation

or is True if EITHER side is True.

Q31.

What is the output of:

print(not True)
Explanation

not reverses the value.

Q32.

What is the value of x after:

x = 10
x += 5
Explanation

x += 5 means x = x + 5.

Q33.

What is the value of x after:

x = 20
x //= 3
Explanation

x //= 3 means x = x // 3 = 6.

Q34.

What happens when you write x++ in Python?

Explanation

Python has no ++; write x += 1 instead.

Q35.

What is the output of:

print("a" in "apple")
Explanation

in checks whether a value is present in a sequence.

Q36.

What is the output of:

print(4 not in [1, 2, 3])
Explanation

4 is not in the list, so not in gives True.

Q37.

What is the output of:

print(2 + 3 * 4)
Explanation

* has higher precedence than +, so 3 * 4 is done first.

Q38.

What is the output of:

print((2 + 3) * 4)
Explanation

Brackets are evaluated first.

Q39.

What is the output of:

print(2 ** 3 ** 2)
Explanation

** works right to left: 3 ** 2 = 9, then 2 ** 9 = 512.

Q40.

What is the output of:

print(10 - 4 - 2)
Explanation

Operators of the same priority work left to right: (10 โˆ’ 4) โˆ’ 2.

Q41.

Which operator has the HIGHEST precedence?

Explanation

After brackets, ** has the highest priority.

Q42.

Which logical operator is evaluated FIRST?

Explanation

The order is not, then and, then or.

Q43.

What is the output of:

print(15 % 4 + 2 ** 2)
Explanation

2 ** 2 = 4 first, then 15 % 4 = 3, and 3 + 4 = 7.

Q44.

What is the output of:

print(3 + 4.0)
Explanation

int + float gives a float (implicit conversion).

Q45.

Python automatically converting int to float in 3 + 4.0 is called:

Explanation

Implicit conversion is done automatically by Python.

Q46.

Converting a value yourself, like int("5"), is called:

Explanation

Explicit conversion uses functions like int(), float() and str().

Q47.

What is the output of:

print(int(7.9))
Explanation

int() cuts off the decimal part; it does not round.

Q48.

What is the output of:

print(float(5))
Explanation

float() converts an integer to a float.

Q49.

What is the output of:

print(str(10) + "0")
Explanation

str(10) is '10', and joining it with '0' gives '100'.

Q50.

What is the output of:

print(bool(0))
Explanation

0 is treated as False.

Q51.

What is the output of:

print(bool(""))
Explanation

An empty string is treated as False.

Q52.

What is the output of:

print(bool("0"))
Explanation

"0" is a non-empty string, so it is True.

Q53.

What is the output of:

print("5" + 5)
Explanation

A string and an integer cannot be added.

Q54.

An error caused by breaking Python's grammar rules, so the program does not run at all, is a:

Explanation

Syntax errors are found before the program runs.

Q55.

An error that occurs while the program is running, like dividing by zero, is a:

Explanation

Runtime errors stop the program in the middle.

Q56.

What error does print(10 / 0) give?

Explanation

Dividing by zero is not possible.

Q57.

A program to find the average uses avg = a + b / 2. It runs but gives a wrong answer. This is a:

Explanation

It runs without any message but the result is wrong; it should be (a + b) / 2.

Q58.

Which error is the HARDEST to find, because Python shows no error message?

Explanation

A logical error gives a wrong result silently.

Q59.

Finding and removing errors from a program is called:

Explanation

Debugging means locating and fixing errors (bugs).