0% found this document useful (0 votes)
46 views6 pages

Python Programming Guess Paper Quiz

The document is a Python programming guess paper consisting of theoretical and practical questions covering various topics such as variables, data types, control flow, functions, file handling, exception handling, and object-oriented programming. It includes multiple-choice questions designed to test knowledge and understanding of Python concepts. The paper contains a total of 30 questions, with 9 theoretical and 21 practical applications.

Uploaded by

sindhuja
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)
46 views6 pages

Python Programming Guess Paper Quiz

The document is a Python programming guess paper consisting of theoretical and practical questions covering various topics such as variables, data types, control flow, functions, file handling, exception handling, and object-oriented programming. It includes multiple-choice questions designed to test knowledge and understanding of Python concepts. The paper contains a total of 30 questions, with 9 theoretical and 21 practical applications.

Uploaded by

sindhuja
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

Python Programming - Guess Paper

A. Theoretical Concepts (9 Questions)

1. Variables & Data Types


Which of the following is an immutable data type in Python?
A. List B. Dictionary C. Tuple D. Set

2. Strings & Sequences


What is the result of this operation?
text = "Python"
print(text[::2])
A. Pto B. yhn C. Pth D. Error

3. Control Flow
Which of these statements is used to terminate a loop immediately in Python?
A. break B. exit C. stop D. pass

4. Dictionaries
In a dictionary, which property must keys satisfy?
A. Keys must be unique and immutable
B. Keys must be integers only
C. Keys can be changed after creation
D. Keys can store multiple values

5. Functions & Modules


Which statement correctly describes keyword arguments?
A. Arguments passed in order of definition
B. Arguments identified by parameter names
C. Arguments that accept multiple values
D. Arguments that must always be integers
6. File Handling
Which file mode creates a new file if it doesnt exist, and overwrites it if it does?
A. 'a' B. 'r' C. 'w' D. 'r+'

7. Exception Handling
Which keyword is used to handle specific exceptions in Python?
A. finally B. except C. raise D. error

8. OOP Concept
Which OOP principle allows an object to use the same method name but different behavior in
subclasses?
A. Abstraction B. Encapsulation C. Inheritance D. Polymorphism

9. OOP Concept
Which of the following automatically runs when an object is deleted?
A. __init__() B. __del__() C. __end__() D. __main__()

-------------------------------------------------------------
B. Practical Application (21 Questions)

10. Variables & Operators


x, y = 15, 4
print(x % y + x // y)
A. 6 B. 7 C. 8 D. 3

11. Type Casting & Input


value = input("Enter: ")
A. <class 'int'> B. <class 'str'> C. <class 'float'> D. <class 'bool'>

12. Conditional Statements


if score >= 90: print("Excellent")
elif score >= 75: print("Good")
elif score >= 50: print("Average")
else: print("Fail")
(score = 60)
A. Excellent B. Good C. Average D. Fail

13. Loops
sum = 0
for n in range(2, 6): sum += n
print(sum)
A. 14 B. 10 C. 12 D. 15

14. Loop & Continue


for i in range(5):
if i == 2 or i == 3:
continue
print(i, end=' ')
A. 0 1 4 B. 0 1 2 C. 1 2 3 D. 0 1 2 3 4

15. String Slicing


text = "PYTHONPROGRAM"
print(text[Link])
A. HONRA B. HOPOA C. HNRG D. HNRGA

16. String Methods


msg = "Python Practice"
print([Link]("Python", "Java").upper())
A. python practice B. PYTHON PRACTICE C. JAVA PRACTICE D. Java Practice

17. List Indexing


data = [5, 10, [15, 20, 25], 30]
print(data[2][1])
A. 10 B. 15 C. 20 D. 25

18. List Methods


nums = [1, 2, 3]
[Link](0, 0)
[Link](4)
A. [0, 1, 2, 3, 4] B. [1, 2, 3, 4] C. [0, 1, 2, 4] D. [1, 2, 3, 0, 4]

19. Tuple Operations


Which statement is valid for tuples?
A. Tuples support element reassignment
B. Tuples can contain lists as elements
C. Tuples are always empty
D. Tuples require identical types

20. Set Operations


A = {2, 4, 6}
B = {4, 8}
print(A | B)
A. {2, 4, 6, 8} B. {4, 6, 8} C. {2, 6, 8} D. {2, 4, 8}

21. Dictionary Access


info = {'name': 'Arjun', 'age': 22}
print([Link]('course', 'Not Found'))
A. age B. None C. Not Found D. Error

22. Dictionary Iteration


fruit = {'apple': 2, 'mango': 3}
for item in fruit:
print(item)
A. apple mango B. 2 3 C. (apple,2)(mango,3) D. None

23. Function Definition


def multiply(a, b=2):
return a * b
print(multiply(4, 3))
A. 7 B. 12 C. 8 D. Error

24. Function Scope


def outer():
x = "local"
print(x)
x = "global"
outer()
print(x)
A. local local B. global global C. local global D. global local

25. Function Arguments


def demo(a, b, c=5):
Which call is invalid?
A. demo(1, 2) B. demo(a=1, b=2, c=3) C. demo(1, c=3, b=2) D. demo(a=1, 2, 3)

26. Module Usage


To generate a random floating number between 0 and 1, use:
A. [Link]() B. [Link]() C. [Link]() D. [Link]()

27. File Handling


with open("[Link]", "w") as f:
[Link]("X\nY")
with open("[Link]", "r") as f:
print(len([Link]()))
A. 1 B. 2 C. 3 D. Error

28. Exception Handling


try:
x=5/0
except:
print("An error occurred")
finally:
print("Done")
A. Done only B. An error occurred C. Both lines printed D. Error in finally

29. OOP Class/Object


class Student:
def __init__(self, name):
[Link] = name
s = Student("Riya")
print("Welcome", [Link])
A. Welcome Riya B. Riya C. Error D. Student

30. OOP Inheritance


class Parent:
def greet(self):
return "Hello"
class Child(Parent):
def greet(self):
return "Hi"
obj = Child()
print([Link]())
A. Hello B. Hi C. Error D. None

You might also like