0% found this document useful (0 votes)
3 views10 pages

CBSE Class11 CS Fundamentals of Python Worksheet

CBSE_Class11_CS_Fundamentals_of_Python_Worksheet

Uploaded by

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

CBSE Class11 CS Fundamentals of Python Worksheet

CBSE_Class11_CS_Fundamentals_of_Python_Worksheet

Uploaded by

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

SAGAR INTERNATIONAL SCHOOL,

PERUNDURAI.
AFFILIATED NO: 1930419
WORKSHEET
CLASS: XI B,C
SUBJECT: COMPUTER SCIENCE
Chapter: Fundamentals of Python
Section 1: Multiple Choice Questions (MCQs)
1. Which of the following is the correct way to declare a variable in
Python?
a) int x = 10
b) x = 10
c) var x = 10
d) declare x = 10
2. What is the output of: print(type(5.0))?
a) <class 'int'>
b) <class 'float'>
c) <class 'double'>
d) Error
3. Which symbol is used for comments in Python?
a) //
b) /* */
c) #
d) <!-- -->
4. What is the correct way to write a function in Python?
a) function myfunc():
b) def myfunc():
c) func myfunc():
d) define myfunc():
5. Which of the following data types is immutable in Python?
a) List
b) Tuple
c) Dictionary
d) Set
6. What does the `len()` function do?
a) Returns the length of an object
b) Calculates the sum
c) Finds the maximum value
d) None of these
7. Which of the following keywords is used for conditional
branching?
a) loop
b) if
c) def
d) else
8. How do you start a while loop in Python?
a) while condition:
b) while(condition)
c) loop while
d) while = condition
9. What will `print(2 ** 3)` output?
a) 8
b) 6
c) 9
d) 5
10. Which of these is a Python tuple?
a) [1, 2, 3]
b) (1, 2, 3)
c) {1, 2, 3}
d) None
11. How is a block of code indicated in Python?
a) Curly braces
b) Indentation
c) Parentheses
d) Semicolon
12. What is the output of `print(type(True))`?
a) <class 'int'>
b) <class 'bool'>
c) <class 'str'>
d) <class 'NoneType'>
13. Which method adds an element to the end of a list?
a) append()
b) add()
c) insert()
d) extend()
14. Which of the following is NOT a Python data type?
a) List
b) Float
c) Char
d) Dictionary
15. What will `print('Hello' + 'World')` output?
a) Hello World
b) HelloWorld
c) Hello+World
d) Error
16. What does the `break` statement do?
a) Exits the loop
b) Skips current iteration
c) Continues to next iteration
d) None
17. Which keyword is used to handle exceptions?
a) try
b) catch
c) except
d) both a and c
18. How do you create an empty dictionary?
a) {}
b) []
c) ()
d) ''
19. What does `range(5)` generate?
a) Numbers from 0 to 5
b) Numbers from 1 to 5
c) Numbers from 0 to 4
d) Numbers from 1 to 4
20. Which function converts a string to an integer?
a) int()
b) str()
c) float()
d) bool()
21. Which of these is the correct way to import a module?
a) import math
b) include math
c) using math
d) require math
22. What is the output of `print(10 // 3)`?
a) 3.33
b) 3
c) 4
d) 3.0
23. How do you start a comment that spans multiple lines?
a) '''
b) //
c) #
d) <!-- -->
24. Which of the following is a valid variable name?
a) 1variable
b) variable_1
c) variable-1
d) variable 1
25. Which statement is used to end a function and return a value?
a) stop
b) return
c) exit
d) break
Section 2: Fill in the Blanks
26. The keyword used to define a function in Python is ______.
27. A loop that executes a block of code while a condition is true
is called a ______ loop.
28. The method to add an item to the end of a list is ______.
29. Python uses ______ indentation to define blocks of code.
30. The operator used for exponentiation in Python is ______.
31. The function used to read input from the user is ______.
32. A ______ is a collection of key-value pairs in Python.
33. To convert a string to lowercase, we use the method ______.
34. The logical AND operator in Python is written as ______.
35. To exit a loop immediately, we use the ______ statement.
36. The symbol used to indicate a comment in Python is ______.
37. The built-in function to find the length of a string is ______.
38. A tuple is different from a list because it is ______.
39. The keyword to define a conditional else block is ______.
40. To handle exceptions, we use the ______ block.
41. Python is a ______-level programming language.
42. Strings are enclosed in ______ or ______ quotes.
43. The function used to convert a number to a string is ______.
44. The index of the first element in a Python list is ______.
45. The operator used for floor division is ______.

Section 3: True/False
51. Python supports both single and double quotes for string
literals. (True/False)
52. Variables need to be declared with a data type before use in
Python. (True/False)
53. The break statement terminates the current loop and exits it
immediately. (True/False)
54. Lists in Python can contain elements of different data types.
(True/False)
55. Python is a case-sensitive language. (True/False)
56. Tuples can be changed after creation. (True/False)
57. The 'elif' keyword is used for else-if conditions in Python.
(True/False)
58. The 'pass' statement does nothing and is used as a
placeholder. (True/False)
59. The 'continue' statement skips the current iteration and moves
to the next. (True/False)
60. Python does not support recursion. (True/False)
61. Python lists are mutable. (True/False)
62. The 'input()' function returns a string. (True/False)
63. Python supports multiple inheritance. (True/False)
64. Indentation is optional in Python. (True/False)
65. A dictionary stores data in key-value pairs. (True/False)

Section 4: Assertion and Reasoning


66. Assertion (A): Python supports object-oriented programming.
Reason (R): Python does not support inheritance or
polymorphism.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
67. Assertion (A): Lists are immutable.
Reason (R): Tuples are mutable.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
68. Assertion (A): The 'break' statement can be used to exit a
loop.
Reason (R): The 'continue' statement exits the loop.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
69. Assertion (A): Python uses indentation to define code blocks.
Reason (R): Curly braces {} are used to define code blocks.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
70. Assertion (A): A tuple can contain elements of different data
types.
Reason (R): Lists can contain elements of the same data type
only.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
71. Assertion (A): Python functions can return multiple values.
Reason (R): Python functions always return a single value.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
72. Assertion (A): The 'try' block is used to catch exceptions.
Reason (R): The 'except' block handles exceptions.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
73. Assertion (A): Python supports both procedural and object-
oriented programming.
Reason (R): Python does not support procedural programming.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
74. Assertion (A): The 'len()' function returns the number of
elements in a collection.
Reason (R): The 'len()' function counts the number of characters
in a string only.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true
75. Assertion (A): Indentation errors cause a SyntaxError in
Python.
Reason (R): Python ignores whitespace while parsing code.
a) Both A and R are true and R is the correct explanation of A
b) Both A and R are true but R is not the correct explanation of A
c) A is true but R is false
d) A is false but R is true

Section 5: Short Answer Questions (2 marks)


76. Write a Python statement to print “Hello, World!”
77. How do you create a list in Python? Provide a sample list of
three elements.
78. What is a variable? How is it used in Python?
79. Explain the use of the if statement in Python.
80. Write a statement to add an element to a set in Python.
81. What is the difference between a list and a tuple?
82. How do you take input from the user in Python?
83. Write the syntax of a while loop.
84. What are Python keywords? Give any two examples.
85. What is the output of print(3 + 2 * 4)? Explain.

Section 6: Short Answer Questions (3 marks)


86. Explain the difference between a list and a tuple in Python
with examples.
87. Write a Python program to find the maximum of two numbers.
88. What is a loop? Explain the types of loops in Python.
89. How do you handle exceptions in Python? Provide a simple
example.
90. Write a program to calculate the factorial of a number using a
while loop.
91. Explain the concept of function in Python with an example.
92. Write a Python program to check whether a number is even or
odd.
93. What is string slicing? Explain with an example.
94. Explain how to add and remove elements from a list.
95. Write a program to print all elements of a list using a for loop.

Section 7: Long Answer Questions (4 marks)


96. Explain Python’s data types with examples.
97. Write a program to check whether a given number is prime or
not.
98. Describe functions in Python and how to pass arguments to
functions.
99. Discuss the concept of recursion with a suitable example in
Python.
100. Explain list comprehension with an example.

Section 8: Long Answer Questions (5 marks)


101. Write a program in Python to perform basic arithmetic
operations (addition, subtraction, multiplication, division) using
functions.
102. Explain Python’s file handling mechanism with examples for
reading and writing files.
103. Describe the various string methods in Python with
examples.
104. Write a Python program to sort a list of numbers using the
bubble sort algorithm.
105. Explain how dictionaries work in Python. Write a program to
count the frequency of words in a given sentence.

You might also like