0% found this document useful (0 votes)
393 views5 pages

Output Based Questions Python Class11

The document contains 50 output-based questions focused on basic Python concepts and if-else statements, specifically designed for Class 11 CBSE students. Each question presents a code snippet followed by the expected output, covering various topics such as string manipulation, arithmetic operations, and boolean evaluations. Additionally, it includes explanations of the bool() function and its behavior with different values.

Uploaded by

sapnayadav4832
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)
393 views5 pages

Output Based Questions Python Class11

The document contains 50 output-based questions focused on basic Python concepts and if-else statements, specifically designed for Class 11 CBSE students. Each question presents a code snippet followed by the expected output, covering various topics such as string manipulation, arithmetic operations, and boolean evaluations. Additionally, it includes explanations of the bool() function and its behavior with different values.

Uploaded by

sapnayadav4832
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/ 5

50 Output-Based Questions on Basic Python and If-Else (Class 11 CBSE)

9. What will be the output of:


s = "hello"
Basic Python Questions: print(s.upper())
1. What will be the output of:
a=5 Output: HELLO
b=3
10. What will be the output of:
print(a + b)
print("abc".isalpha())
Output: 8
Output: True
2. What will be the output of:
11. What will be the output of:
x = 10
print("123".isdigit())
y=4
print(x % y) Output: True

Output: 2 12. What will be the output of:


print(" ".isspace())
3. What will be the output of:
print("Hello" + "World") Output: True

Output: HelloWorld 13. What will be the output of:


x = 3.5
4. What will be the output of:
print(int(x))
print(2 * "Hi ")
Output: 3
Output: Hi Hi
14. What will be the output of:
5. What will be the output of:
print(bool(0))
a = 10
a += 5 Output: False
print(a)
15. What will be the output of:
Output: 15 print(bool(10))

6. What will be the output of: Output: True


a=7
b=2 16. What will be the output of:
print(a // b) print(type("123"))

Output: 3 Output: <class 'str'>

7. What will be the output of: 17. What will be the output of:
name = "Ankit" print(type(5))
print(name[2])
Output: <class 'int'>
Output: k
18. What will be the output of:
8. What will be the output of: print("7" * 3)
print("Python"[-1])
Output: 777
Output: n

1
50 Output-Based Questions on Basic Python and If-Else (Class 11 CBSE)

19. What will be the output of: If-Else Python Questions:


a = [1, 2, 3] 27. What will be the output of:
print(len(a)) a = 10
if a > 5:
Output: 3 print('Greater')
20. What will be the output of: else:
print(3**2) print('Smaller')

Output: 9 Output: Greater

21. What will be the output of: 28. What will be the output of:
a = "Python" a=3
print(a[1:4]) if a % 2 == 0:
print('Even')
Output: yth else:
print('Odd')
22. What will be the output of:
print("PYTHON".lower()) Output: Odd

Output: python 29. What will be the output of:


x = 10
23. What will be the output of: if x > 20:
print("python".capitalize()) print('Big')
else:
Output: Python
print('Small')
24. What will be the output of:
print(len("cbse")) Output: Small

30. What will be the output of:


Output: 4
x=4
25. What will be the output of: if x > 2:
print("abc".find("b")) print('A')
if x > 3:
Output: 1 print('B')
26. print(bool("Hello")) Output: A
# Output: True
B
print(bool(15))
# Output: True 31. What will be the output of:
print(bool("")) a = 10
# Output: False b = 20
print(bool(0))
if a == b:
# Output: False
print('Equal')
print(bool([1, 2, 3]))
# Output: True else:
print(bool([])) print('Not Equal')
# Output: False
Output: Not Equal
print(bool(None))
# Output: False

2
50 Output-Based Questions on Basic Python and If-Else (Class 11 CBSE)

32. What will be the output of: 37. What will be the output of:
x=5 marks = 95
if x != 5: if marks >= 90:
print('Wrong') print('Grade A')
else: else:
print('Correct') print('Grade B')

Output: Correct Output: Grade A

33. What will be the output of: 38. What will be the output of:
x = 100 x = 10
if x >= 50: y=5
print('Pass') if x > y:
else: print('x is greater')
print('Fail') else:
print('y is greater')
Output: Pass
Output: x is greater
34. What will be the output of:
x = -1 39. What will be the output of:
if x > 0: x=5
print('Positive') if x > 0 and x < 10:
elif x < 0: print('Valid')
print('Negative') else:
else: print('Invalid')
print('Zero')
Output: Valid
Output: Negative
40. What will be the output of:
35. What will be the output of: x = 10
x=0 if not x < 5:
if x > 0: print('Yes')
print('Positive') else:
elif x < 0: print('No')
print('Negative')
else: Output: Yes
print('Zero') 41. What will be the output of:
Output: Zero a=2
b=3
36. What will be the output of: if a + b == 5:
x = 90 print('Sum is 5')
if x > 90:
print('A+') Output: Sum is 5
elif x > 80:
print('A')
else:
print('B')

Output: A

3
50 Output-Based Questions on Basic Python and If-Else (Class 11 CBSE)

42. What will be the output of: 47. What will be the output of:
x = 15 a=3
if x % 3 == 0: if a > 0:
print('Divisible by 3') print('Pos')
else: if a < 10:
print('Not divisible by 3') print('Single Digit')

Output: Divisible by 3 Output: Pos


Single Digit
43. What will be the output of:
num = 2 48. What will be the output of:
if num % 2 == 0: x=7
if num > 0: if x % 2 != 0:
print('Positive Even') print('Odd')
else:
Output: Positive Even print('Even')
44. What will be the output of: Output: Odd
x=9
if x > 5: 49. What will be the output of:
print('First') marks = 45
else: if marks >= 50:
print('Second') print('Pass')
print('Third') else:
print('Fail')
Output: First
Third Output: Fail

45. What will be the output of: 50. What will be the output of:
a=6 a=0
if a < 5: if a:
print('A') print('Yes')
elif a == 6: else:
print('B') print('No')
else:
print('C') Output: No

Output: B 51. What will be the output of:


a=1
46. What will be the output of: b=2
x = 10 if a < b:
y = 10 print('Smaller')
if x == y: else:
print('Same') print('Larger')
else:
print('Different') Output: Smaller

Output: Same

4
50 Output-Based Questions on Basic Python and If-Else (Class 11 CBSE)

52. In Python, bool() is a built-in function


used to convert a given value into its
corresponding Boolean representation,
either True or False.

The bool() function returns False for the


following "falsy" values:
 False
 None
 Numeric zeros: 0, 0.0, 0j (complex zero)
 Empty sequences: '' (empty
string), [] (empty list), () (empty
tuple), {} (empty dictionary), set() (empty
set)

Different output of bool()method

print(bool(True)) # Output: True

print(bool(False)) # Output: False

print(bool(0)) # Output: False

print(bool(1)) # Output: True

print(bool(0.0)) # Output: False

print(bool(3.14))# Output: True

print(bool('')) # Output: False

print(bool('Hello'))# Output: True

print(bool([])) # Output: False

print(bool([1, 2])) # Output: True

print(bool(None)) # Output: False

You might also like