0% found this document useful (0 votes)
17 views9 pages

SL 6 Cs

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views9 pages

SL 6 Cs

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

SRI VETRI VIDHYALAYA PUBLIC SCHOOL, E.

VELLANUR
SLIP TEST-6
CLASS: XII
MARKS:50
SUBJECT:COMPUTER SCIENCE [083]
DATE:9.08.24
__________________________________________________________________
______________
1. Which of the following is an invalid variable?
1. my_day_2 2. 2nd_day 3. Day_two 4. _2
2. Which of these is not a core data type?
1. Lists 2. Dictionary 3. Tuples 4. Class
3. What will be the value of the expression? 14 + 13 % 15
1. 14 2. 27 3. 12 4. 0
4. Evaluate the expression given below if A = 16 and B = 15. A % B // A
1. 0.0 2. 0 3. 1.0 4. 1
5. Which among the following list of operators has the highest precedence? +, -,
**, %, /, <>, |
1. <> 2. ** 3. I 4. %
6. Which value type does input () return ?
1. Boolean 2. String 3. Int 4. Float
7. Which of the following four code fragments will yield following output?
Eina
Mina
Dika S
Select all of the function calls that result in this output

1|Page
1. print('''Eina\nMina\nDika''') 2. print('''EinaMinaDika''')
3. print('Eina\nMina\nDika') 4. print('EinaMinaDika')
8. Predict the output of the following code fragments:
count = 0
while count < 10:
print ("Hello")
count += 1
9. for Name in ['Jayes', 'Ramya', 'Taruna', 'Suraj'] :
print (Name)
if Name[0] == 'T' :
break else :
print ('Finished!')
print ('Got it!')
10. What the does random. Seed(3) return?
a) True b) None c) 3 d) 1
11. Which of the following is equivalent to random.randrange(3)?
a) range(3) b) random.choice(range(0, 3))
c) random.shuffle(range(3)) d) random.select(range(3))
12. def test(i,j):
if(i==0):
return j
else:
return test(i-1,i+j)
print(test(4,7))
a) 13 b) 7 c) Infinite loop d) 17

2|Page
13. For a given declaration in Python as s = "WELCOME", which of the
following will be the correct output of print(s[1::2])?

1. WEL
2. COME
3. WLOE
4. ECM

14. Which of the following is not a Tuple in Python?

a.(1,2,3) b.("One","Two","Three") c.(10,) d.("One")

15. In a Python expression, when conversion of a value's data type is done


automatically by the compiler without programmer's intervention, it is called -
________________.

16. The explicit conversion of an operand to a specific type is


called____________.

17. A ______________ statement skips the rest of the loop and jumps over to the
statement following the loop

18. The _________ statement skips the rest of the loop statements and causes the
next iteration of the loop to take place.
True/False Questions

19. The value of the expressions 4/(3*(2 - 1)) and 4/3*(2 - 1) is the same.

20. The expression 2**2**3 is evaluated as: (2**2)**3.

21. In a nested loop, a break statement terminates all the nested loops in one go

22. The numbered position of a letter in a string is called ...............

a.position b.integer position c.index d.location

23. The keys of a dictionary must be of ............... types.

a.integer b.mutable c.immutable d.any of these

24. Following set of commands is executed in shell, what will be the output?

3|Page
>>>str = "hello"
>>>str[:2]
>>>

a.he b.lo c.olleh d.hello

25. What data type is the object below ?


L = [1, 23, 'hello', 1]

1. list
2. dictionary
3. array
4. tuple

26. What is the value of the following expression ?


3 + 3.00, 3**3.0

a.(6.0, 27.0) b.(6.0, 9.00) c.(6, 27) d.[6.0, 27.0]

27. You have the following code segment :

String1 = "my"
String2 = "work"
print(String1+String2.upper())
What is the output of this code?

a.mywork b.MY Work c.myWORK d.My Work

28. Which line of code will cause an error ?

1. num= [5, 4, 3, [2], 1]


2. print(num[0])
3. print(num[3][0])
4. print(num[5])

1. Line 3
2. Line 2
3. Line 4
4. Line 1

4|Page
29. Which is the correct form of declaration of dictionary ?

1. Day = {1:'Monday', 2:'Tuesday', 3:'wednesday'}


2. Day = {1;'Monday', 2;'Tuesday', 3;'wednesday'}
3. Day = [1:'Monday', 2:'Tuesday', 3:'wednesday']
4. Day = {1'monday', 2'tuesday', 3'wednesday'}

30. Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following
is incorrect ?

1. print(T[1])
2. T[2] = -29
3. print(max(T))
4. print(len(T))

31. Write a python script that traverses through an input string and prints its
characters in different lines - two characters per line.

32. Write a Python statement to declare a Dictionary named ClassRoll with Keys
as 1, 2, 3 and corresponding values as 'Reena', 'Rakesh', 'Zareen' respectively.

33. What will be the output produced by following code fragments ?

y = str(123)
x = "hello" \* 3
print(x, y)
x = "hello" + "world"
y = len(x)
print(y, x)
34. What will be the output produced by following code fragments ?

x = "hello" + \
"to Python" + \
"world"
for char in x :
y = char
print(y, ':', end=" ")
35. What will be the output produced by following code fragments ?

x = "hello world"
print(x[:2], x[:-2], x[-2:])
5|Page
print(x[6], x[2:4])
print(x[2:-3], x[-4:-2])
36. Predict the output of the following code snippet ?

a = [1, 2, 3, 4, 5]
print(a[3:0:-1])
37. Predict the output of the following code snippet?

arr = [1, 2, 3, 4, 5, 6]
for i in range(1, 6):
arr[i - 1] = arr[i]
for i in range(0, 6):
print(arr[i], end = "")
38. Predict the output of the following code snippet ?

Numbers = [9, 18, 27, 36]


for Num in Numbers :
for N in range(1, Num % 8) :
print(N, "#", end=" ")
print( )
39. Find the errors. State reasons.

t = [1, "a", 9.2]


t[0] = 6
40. Find the errors. State reasons.

for Name in [Amar, Shveta, Parag]


IF Name[0] = 'S':
print(Name)
41. What would be the output of following code if ntpl = ("Hello", "Nita",
"How's", "life ?") ?

(a, b, c, d) = ntpl
print("a is:", a)
print("b is:", b)
print("c is:", c)
print("d is:", d)
ntpl = (a, b, c, d)
print(ntpl[0][0] + ntpl[1][1], ntpl[1])
42. What will be the output of the following code snippet ?

6|Page
rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"}
id1 = id(rec)
del rec
rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"}
id2 = id(rec)
print(id1 == id2)
43. What will be the output of the following code snippet ?

rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"}


id1 = id(rec)
del rec
rec = {"Name" : "Python", "Age" : "20", "Addr" : "NJ", "Country" : "USA"}
id2 = id(rec)
print(id1 == id2)

a.True b.False c.1 d.Exception

44. What will be the output of the following code snippet ?

my_dict = {}
my_dict[(1,2,4)] = 8
my_dict[(4,2,1)] = 10
my_dict[(1,2)] = 12
sum = 0
for k in my_dict:
sum += my_dict[k]
print(sum)
print(my_dict)
45. Find the output

a = []
for i in range(0,100):
if (i % 3 == 0) or (i % 5 == 0) :
a.append(i)
print(a)
46. Which of the following is an invalid variable?

1. my_day_2
2. 2nd_day
3. Day_two

7|Page
4. _2

47. Find the invalid identifier from the following:

a.name b.break c.section d.mark12

48. How would you write x y in Python as an expression ?

a.x^y b.x**y c.x^^y d.none of these

49. Which two operators can be used on numeric values in Python?

a.@ b.% c.+ d.#

50. What data type is the object below ?


L = 1, 23, 'hello', 1

a.list b.dictionary c.array d.tuple

8|Page
9|Page

You might also like