Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Xi Ip

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

FELLOWSHIP MISSION SCHOOL

HALF-YEARLY
SUB:-IP DATE:-
STD:-XI SET -D MARKS:-
70
SECTION A

1.Which of the following can be used to delete item(s) from a dictionary?


(a) del statement (b) get( ) (c) getitem( ) (d) all of these
2. Which of the following will raise an error if the given key is not found in the dictionary?
(a) del statement (b) pop( ) (c) getitem( ) (d) all of these
3. Which of the following is correct with respect to above Python code ? d = {"a" : 3, "b" : 7}
(a) a dictionary d is created. (c) 3 and 7 are the values of dictionary d.
(b) a and b are the keys of dictionary d. (d) All of these.
4. What would the following code print? d={'spring': 'autumn', 'autumn': 'fall', 'fall': 'spring')
print (d['autumn'1)
(a) autumn (b) fall (c) spring (d) Erro

5. Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[1: 4] return ?
(a) [10, 20, 30, 40] (b) [20, 30, 40, 50] (c) [20, 30, 40] (d) [30, 40, 50]
6. Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[2 : -2] return?
(a) [10, 20, 30, 40] (b) [20, 30, 40, 50] (c) [20, 30, 40] (d) [30, 40, 50]
7. Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[-4: -1] return?
(a) [20, 30, 40] (6) [30, 40, 50] (c) [40, 50, 60] (d) [50, 60, 70]
8. Given a list L= [10, 20, 30, 40, 50, 60, 70], what would L[-3: 99] return?
(a) [20, 30, 40] (b) [30, 40, 50] (c) [40, 50, 60] (d) [50, 60, 70]
9. Which of the following commands will create a list?
a) list1 = list() b) list1 = [] c) list1 = list([1, 2, 3]) d) all of the mentioned
10. What is the output when we execute list(“hello”)?
a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] b) [‘hello’] c) [‘llo’] d) [‘olleh’]
11. Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?
a) 5 b) 4 c) None d) Error
12. Suppose list1 is [2445,133,12454,123], what is max(list1)?
a) 2445
b) 133
c) 12454
d) 123
13. What is the value of the expression 100 // 25 ?
(a) 4 (6) 4.0 (c) 2.5 (d) none of these
14. In Python, a variable must be declared before it is assigned a value.
(a) True (b) False (c) Only in Functions (d) Only in modules
15. In Python, a variable is assigned a value of one type, and then later assigned a value of a different type. This will
yield
(a) Warning (b) Error (c) None (d) No Error
16.. To add a new element to a list we use which command?
a) list1.add(5) c) list1.addLast(5)
b) list1.append(5) d) list1.addEnd(5)
17. To insert 5 to the third position in list1, we use which command?
a) list1.insert(3, 5) c) list1.add(3, 5)
b) list1.insert(2, 5) d) list1.append(3, 5)
18. To remove string “hello” from list1, we use which command?
a) list1.remove(“hello”) c) list1.removeAll(“hello”)
b) list1.remove(hello) d) list1.removeOne(“hello”)

SECTION B

Q2: Answer the following question : [7 x 2=14M]

1. What are tokens? List 5 tokens in Python.


2. What do you mean by identifiers?
3. What is “None”?
4. What will be the output of the following ? (87//5.0) == (87//5)
5. Find the errors - s=”PURA VIDA” Print(s[9] + s[9:15])
6. Start with the list[8,9,10]. Do the following using list functions
(a) Set the second entry (index 1) to 17
(b) Add 4, 5 and 6 to the end of the list.

7. What are nested Lists?

SECTION C

Q3 Do as dircted: [5 x 3=15M]

1. Write a program to check if a number is present in the list or not. If the number is present, print the position
of the number. Print an appropriate message if the number is not present in the list.
2. Program to read a list and print only those numbrs which are divisible by 5 and not by 7
3. WAP to print following pattern without using any nested loop.

A
BB
CCC
DDDD

SECTION D

Q4: Answer the following questions: [2 x 4=8M]


1. What are the limitations of Python?Explain any 3.
2. What will be the output of the following ?
List = [1,2,3,4,5,6,7,8,9,10]’
For I in range(0,len(mylist)):
If i%2 == 0:
Print(List[i], end=” ”)

SECTION E

Q5: Do as dircted: [5 x 3=15M]

1. What will be value of x after evaluation of each of following separately:


i. x = 29 / 5
ii. x = 39 // 4 * 2
iii. x = 3 ** 2 ** 2
iv. x = 2 ** 5 % 3 -5
v. x = 99**3
2. WAP to create a dictionary and accept a key from the user and remove that key from the dictionary if
present also give proper message.
3. Explain the use of following math library functions available in Python with example:
1. ceil()
2. sqrt()
3. floor()
4. log()
5. pow()

You might also like