CS Grade XI One Marks-3
CS Grade XI One Marks-3
Ponneri
27 May 2024
11) Who developed python?
a) Dennis Ritchie b) Guido van Rossum c) Bjarne Stroustrup d) James Gosling
12) ____ indicates that it is waiting for a user command to be entered.
a) >>> b) << c) >>> d) >
13) Which of the following function converts the argument into string before writing to the screen?
a) print() b) input() c) read() d) write()
a) 2 b) 2 c) 2 d) None of These
3 3 3
4 4 4
4 4 4
6 6 6
6 8 8
6 6
9 9
12
29) The break and continue statements, together are called _____ statement.
a) Jump b) goto c) Compound d) None of these
4. Lists in python
1) List can contain values of these types:
a) integers b) float c) lists d) All of these
2) Which of the following function is used to add an element at the end of the list?
a) extend() b) append() c) insert() d) None of these
3) The data type list is an ordered sequence and made up of one or more elements.
a) Mutable b) Immutable c) Both a and b d) None of these
4) Which statement from the list below will create a new list?
a) new_l = [1, 2, 3, 4] b) new_l = list() c) Both a and b d) None of these
5) What will be the output of the following python code?
new_list = [‘P’,’y’,’t’,’h’,’o’,’n’]
print(len(new_list))
a) 6 b) 7 c) 8 d) 9
6) Python allows us to replicate a list using repetition operator depicted by symbol ___
a) – b b) + c) / d) *
7) We can access each element of the list or traverse a list using ___
a) For loop b) While loop c) Both a and b d) None of these
8) Returns index of the first occurrence of the element in the list. If the element is not present, ValueError
is generated.
a) insert() b) index() c) count() d) None of these
9) Function returns the element whose index is passed as parameter to this function and also removes it
from the list.
a) push() b) remove() c) pop() d) None of these
5. Tuples
1) Which of the following statements will create a tuple ?
a) tp1 = ("a", "b") b) tp1[2] = ("a", "b") c) tp1 = (3)*3 d) None of these
2) Choose the correct statement(s).
a) Both tuples and lists are immutable.
b) Tuples are immutable while lists are mutable.
c) Both tuples and lists are mutable.
d) Tuples are mutable while lists are immutable.
3) Choose the correct statement(s).
a) In Python, a tuple can contain only integers as its elements,
b) In Python, a tuple can contain only strings as its elements.
c) In Python, a tuple can contain elements of different types.
d) In Python, a tuple can contain either string or integer but not both at a time.
6. Dictionaries
1) Dictionaries are.................. set of elements.
a) Sorted b) Ordered c) unordered d) random
2) Which of the following will create a dictionary with given keys and a common value?
a) fromkeys() b) update () c) setdefault() d) All of these
3) What will be printed by the following statements? .
D1 = {“cat”:12,”dog”:6,”elephant”:23,”bear”:20}
print(25 in D1)
a) True b) False c) Error d) None