Loading samples...
Loading samples...
py-sample-1
Class 11 Revision - Comprehensive Assessment
Which of the following is NOT a Python data type?
What is the output of print(2 ** 3)?
Which symbol is used for comments in Python?
What does len([1, 2, 3, 4]) return?
Which keyword is used to define a function in Python?
What is the result of 10 // 3?
Which method adds an element to the end of a list?
What is the output of 'hello'[1:4]?
Which operator is used for exponentiation?
What does the range(5) produce?
Explain the difference between a list and a tuple in Python. Give two key differences.
[3 marks]What is type casting? Write the functions used for converting: (a) string to integer, (b) integer to string, (c) string to float.
[3 marks]Write the output of the following code: x = 5 y = 2 print(x // y) print(x ** y)
[2 marks]Explain the use of break and continue statements with examples.
[3 marks]What are Python's logical operators? Write their symbols and meanings.
[3 marks]Differentiate between break and continue with a code example for each.
[4 marks]What is a dictionary in Python? How is it different from a list?
[3 marks]Write a Python expression to check if a number 'n' is even.
[2 marks]Explain the concept of string slicing with an example.
[3 marks]What is the purpose of the 'in' and 'not in' operators? Give an example.
[2 marks]Write a Python program to calculate the factorial of a number using a for loop.
[5 marks]Write a program to check if a given string is a palindrome.
[5 marks]Write a function that accepts a list and returns the sum of all even numbers in it.
[5 marks]Create a program to print the Fibonacci series up to n terms (user input).
[5 marks]Write a program that counts the frequency of each character in a string using a dictionary.
[5 marks]Write a function to find the maximum of three numbers without using max().
[5 marks]Find the error in the following code and correct it: myList = [1, 2, 3] myList.append[4] print(myList)
[3 marks]Explanation:append() is a method that uses parentheses (), not square brackets []
Predict the output: x = [1, 2, 3] y = x y.append(4) print(x)
[2 marks]Explanation:Lists are mutable objects; y is a reference to the same list as x
Find and fix the error: if x > 5 print('x is greater') else: print('x is smaller')
[3 marks]Explanation:Python requires a colon (:) after if, for, while, def, class statements
Predict the output: for i in range(3): print(i, end=' ') else: print('Done')
[2 marks]Explanation:The else block executes after the loop completes normally (no break)
Find the error: t = (1, 2, 3) t[0] = 5 print(t)
[3 marks]Explanation:Tuples are immutable - they cannot be modified after creation
Predict output: a = 5 b = 2 print(a / b) print(a // b)
[2 marks]Explanation:/ returns float division, // returns integer (floor) division
What is wrong with this code? if x = 10: print('Ten')
[2 marks]Explanation:In if statements, use == for comparison, not = for assignment
Predict output: s = 'Python' print(s[1:4]) print(s[-1])
[3 marks]Explanation:s[1:4] slices from index 1 to 3 (characters 1,2,3). s[-1] gets the last character