Professional Documents
Culture Documents
Victoria Public SR Sec School Class 12 - Computer Science
Victoria Public SR Sec School Class 12 - Computer Science
General Instructions:
Section A
Attempt any 20 questions
1. What is the value of this expression, 3*3**1? [0.77]
a) 3 b) 9
c) 1 d) 27
2. Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following is incorrect? [0.77]
c) print(max(T)) d) print(len(T))
3. Which of the following mode will refer to binary data? [0.77]
a) b b) w
c) + d) r
4. The def keyword is followed by the function name and [0.77]
a) parentheses b) argument
c) parameter d) classes
5. Which of the following functions will not result in an error when no arguments are passed [0.77]
to it?
a) float() b) min()
c) all() d) divmod()
6. It is a way to convey a Python object into a character stream: [0.77]
a) Unpickling b) Pickling
1/9
c) Int read() d) Void close()
8. A ________ can get input from live interaction through keyboard/GUI or it may take input as [0.77]
command line arguments or from the files.
a) Code b) Program
c) Class d) Method
9. To read the next line of the file from a file object infi, we use [0.77]
a) infi.read() b) infi.readlines()
c) infi.readline() d) infi.read(all)
10. Which of the following expressions is an example of type casting? [0.77]
A. 4.0 + float(6)
B. 5.3 + 6.3
C. 5.0 + 3
D. int(3.1) + 7
a) B, C b) A, D
c) A, D d) A, C
11. The following set of commands is executed in shell, what will be the output? [0.77]
>>>str = "hello"
>>>str[:2]
>>>
a) hello b) lo
c) olleh d) he
12. The readlines( ) method returns [0.77]
c) a stack d) a heap
15. To read the remaining lines of the file from a file object infi, we use [0.77]
a) nfi.read( ) b) infi.readlines( )
c) infi.read(all) d) infi.readline( )
16. Which attribute is used to return access mode with that file was opened? [0.77]
a) file.mode b) file.mode.type
2/9
c) mode.file.name d) mode.file
17. Which of the following is not a valid mode to open a file? [0.77]
a) rw b) r+
c) ab d) wb+
18. Which one of these is floor division operator? [0.77]
a) // b) /
c) % d) none of these
19. Which of the following is an invalid statement? [0.77]
a) void b) None
c) bool d) int
21. Suppose there is a list such that: l = [2, 3, 4]. [0.77]
If we want to print this list in reverse order, which of the following methods should be
used?
a) reversed(I) b) list(reversed(I))
c) list(reverse[(I)]) d) reverse(I)
22. If return statement is not used inside the function, the function will return: [0.77]
c) None object d) 0
23. If a file is opened for writing, which of the following statements are true? [0.77]
a. The file must exist on the disk on the specified path.
b. If the file exists at the specified path, the file is successfully opened.
c. The file even if at a different location on disk other than the specified path, will get
opened.
d. Python gives error if the file does not exist at the specified path.
e. Python will create a new empty file at the specified path if the file does not exist at the
specified path.
f. The existing contents of the file get erased as soon as you open the file.
a) b, e, f b) b, c, f
c) a, b, c d) d, e, f
24. In file handling, what does these terms means "r and a"? [0.77]
3/9
25. Information stored on a storage device with a specific name is called a ________. [0.77]
a) array b) file
a) A, C b) B, D
c) A, D d) C, D
27. What is the output of the following program : [0.77]
print Hello World [:: -1]
a) mywork b) work
c) my d) my work
29. Which of the following is/are built-in function(s)? [0.77]
c) type() d) print()
30. What is the output of the functions shown below? [0.77]
float('-infinity')
float('inf')
a) double b) None
c) null d) int
32. Which of the following format of files can be created programmatically through Python to [0.77]
store some data?
A. Zip files
4/9
B. Text files
C. Video files
D. Binary files
a) A and D b) B and D
c) A and B d) D and C
33. Which line of code produces an error? [0.77]
c) "one" + 'two' d) 1 + 2
34. You have the following code segment: [0.77]
print ("Here we have a line of text \n and \n we can do \n newlines!")
What is the output of this code?
a) 3 is maximum b) 4
c) 4 is maximum d) 3
37. Which code segment will NOT reach its print( ) function? [0.77]
5/9
>>> str = "hello"
>>> str[:2]
a) he b) llo
c) ello d) hel
39. To read twelve characters from a file object infi, we use [0.77]
a) infi.read(12) b) infi.readline(12)
c) infi.read(13) d) infi.readlines(12)
40. Which of the following are sequence of character data? [0.77]
a) Lists b) Tuples
c) Strings d) Dictionaries
41. Which of the following statements will print the following? [0.77]
hello-how-are-you
A. print('hello', 'how', 'are', 'you')
B. print('hello', 'how', 'are', 'you' + '-' * 4)
C. print('hello-'+ 'how-are-you')
D. print ('hello' + '-' + 'how' + '-' + 'are' + '-' + 'you')
a) B, C b) A, D
c) A, C d) C, D
42. What data type is the object below? [0.77]
L= [1, 23, 'hello', 1]
a) dictionary b) array
c) tuple d) list
43. What is the output of the function shown below? [0.77]
hex(15)
a) 0xF b) 0xf
c) 0Xf d) f
44. Which of the following function calls can be used to invoke the below function definition? [0.77]
def test(a, b, c, d)
i. test(1, 2, 3, 4)
ii. test(a = 1, 2, 3, 4)
iii. test(a = 1, b = 2, c = 3, 4)
iv. test(a = 1, b = 2, c = 3, d = 4)
6/9
a=a*2
>>>function1("hello")
a) d, e, f b) a, e, f
c) b, d, e d) a, b, d
47. What is the output of following code ? [0.77]
def f():
x = (2856 / 156) % 89
print(x++)
x* = 34
f()
a) 19 b) 18
c) 646 d) Error
48. What is a variable defined outside all the functions referred to as? [0.77]
a) c, d b) b, d
c) a, c d) a, d
Section C
Attempt any 5 questions
7/9
Question No. 50 to 55 are based on the given text. Read the text carefully and answer the [4.62]
questions:
a = [36, 29, 21, 19, 50, 72, 34]
print("Original list:", a)
#iterating over a
for i in ________: #Fill 1
j = a.index(i)
#i is not the first element
while ________ #Fill 2
#not in order
if ________: #Fill 3
#swap
________ #Fill 4
else:
#in order
break
j = ________ #Fill 5
print("Sorted list:", a)
a) a b) 1
c) i d) list
51. Choose the correct validation for Fill 2.
a) j = 0 b) j < 0:
c) j > 0 d) j > 0:
52. Choose the correction condition for Fill 3.
a) a[j - 1], a[j] = a[j], a[j - 1] b) a[j - 3], a[j] = a[j], a[j - 2]
c) a[j - 2], a[j] == a[j], a[j - 1] d) a[j - 3], a[j - 2] = a[j], a[j - 2]
54. Choose the correct condition for Fill 5.
a) j + 2 b) j
c) j - 1 d) j + 1
55. What can be output obtained?
a) Original list: [36, 29, 21, 19, 50, 72, 34] b) Original list: [36, 29, 21, 19, 50, 72,
Sorted list: [72, 50, 36, 34, 29, 21, 19] 34]
Sorted list: [34, 36, 50, 72, 19, 21, 29]
8/9
c) Sorted list: [19, 21, 29, 70, 50, 36, 34] d) Original list: [36, 29, 21, 19, 50, 72,
34]
Sorted list: [19, 21, 29, 34, 36, 50, 72]
9/9