Swalnama.
pk
Township Lahore
Email: [Link]@[Link]
Name: Roll No.: Total Marks: /40
Syllabus: Ch#2: Python Programming Test No.: 2 Date: DD/MM/YYYY
Computer Time:10min Total Marks:8 Objective Part Class:11
Note: Four possible answer a,b,c and d to each question are given. The choice which you think is correct ,fill that circle in
front of that questions with Marker or Pen ink, Cutting or filling two or more circles will result in zero mark in that question.
1 ⒶⒷⒸⒹ 2 ⒶⒷⒸⒹ 3 ⒶⒷⒸⒹ 4 ⒶⒷⒸⒹ 5 ⒶⒷⒸⒹ 6 ⒶⒷⒸⒹ 7 ⒶⒷⒸⒹ
8 ⒶⒷⒸⒹ
Q:No.1 8*1=8
1. Which loop type in python is used to iterate over a collection such as lists?
Ⓐ While Ⓑ For Ⓒ Do-while Ⓓ Repeat
2. Which keyword is used to define a function in python?
Ⓐ Ⓑ Ⓒ Ⓓ
3. Which operation is used to combine two lists?
Ⓐ combine() Ⓑ concat() Ⓒ + Ⓓ merge()
4. Which of the following is a valid module import?
Ⓐ [Link] Ⓑ library random Ⓒ include random Ⓓ import random
5. Who is the creator of Python programming language?
Ⓐ Brendan Eich Ⓑ James Gosling Ⓒ Guido Van Rossum Ⓓ Bjarne Stroustrup
6. What is the correct way to declare a variable in Python?
Ⓐ 10 Ⓑ : 10 Ⓒ 10 Ⓓ 10
7. Which is correct order of operator precedence (Highest to lowest)?
Ⓐ (),**,*,+ Ⓑ **,(),*,+ Ⓒ *,(),,+,** Ⓓ +,*,**,()
How many times will the loop run? 2,10,3 :
8.
Ⓐ 3 Ⓑ 4 Ⓒ 5 Ⓓ Infinite
Computer Part( I) Total Marks:32 Time :45 Min Subjective Part Class:11
Q:No.2 Give short answers to any FOUR of the following questions. 4*2=8
1) Explain the purpose of using comments in Python code?
2) What is Polymorphism? Why is it useful?
3) How can we modify a list using both indexing and methods together?
4) Define keyword.
5) List steps involved in the process of writing and runni9ng a Python program.
Q:No.3 Give short answers to any FOUR of the following questions. 4*2=8
1) Explain the difference between class and object in Python.
2) What do you know about Exception Handling?
3) Why a tuple is called immutable in Python?
4) How functions help in writing better Python programs?
5) List some reasons to use built-in Python libraries?
Q:No.4 Give short answers to any FOUR of the following questions. 4*2=8
1) How does short hand if-else statement differ from the regular if-else statement?
2) Explain how default parameters work in Python functions.
3) What will be the output of the given code: 2,6 ;
4) Why is decision making used in Python programs?
5) How do compound assignment operators save time in coding?
Attempt Any ONE questions from this section: Part II (8)
Q:No.5 Explain the concept of variables in Python.
Write a Python program using while loop that prints all the odd numbers between 1 and 100. Also count and print total
Q:No.6
number of odd numbers