Xii CS Tour 1&2-Worksheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

VELAMMAL BODHI CAMPUS – KUMBAKONAM

WORKSHEET ON PYTHON REVISION TOUR

1. Ram is trying to write a program on reversing the string he couldn’t able to complete the code.
Help him by writing code for him. (Competency based – Program writing)
2. Find the output for the following code. (Competency based)

3. Find the output for the below statements (Competency based)

4. Find the output of below code (Competency based)

5. There is a list called word=[‘I am a code’, ‘awesome’, ‘we all gathered for a reason’]. Write a
program to re-arrange this list of sentence in descending order based on the length of the
sentence. (Competency based – Program writing)
6. Write a program to print entire lower case alphabets from a to z. Note: You can only declare
the starting alphabet not all the alphabets. (Competency based – Program writing)
7. If there is an argument starting with ** in function header, what type of argument it is? (MCQ)
a. Variable length argument c. Positional argument
b. Keyword variable length argument d. Keyword argument
8. Write output of the following code

9. Find the output of the below code (Competency based)

10. Find the output of the code given (Competency based)

11. Fill in the blanks, so the below code will produce the output “Max” (Competency based)

12. Rewrite the code without errors and write the output of below code (Competency based)

Velammal Bodhi Campus – Kumbakonam (Hariharan S, Herold R A)


13. What will be the output for the following code (Competency based)

14. Write output of below statement. (Competency based)

15. Find error in the following code(if any) and correct code by rewriting code and underline the
correction: (Finding error)

16. The below code is to convert the list of sentence to list of words. Fill in the blanks so the code
works in desired way. (Competency based – Fill up ½ mark for each)

17. Find the output of below code

18. The below code is to convert the given string in alphabetic order. Fill in the blanks so the code
works properly. Example: if ‘apple’ is the input, the output will be ‘aelpp’ (Competency based –
Fill up ½ mark for each)

19. Among the given option choose the correct function that does not belong to string datatype.
(MCQ)
a. strip() b. index() c. replace() d. reverse()
20. In string slicing starting index and stop index is also called as ______________ (Fill in the
blanks)
Velammal Bodhi Campus – Kumbakonam (Hariharan S, Herold R A)
21. Which of the following options is a keyword?
a. Def b. true c. False d. Break
22. Which of the following options is a relational operator?
a. = b. %= c. >= d. +=
23. Which of the following options is an identifier?
a. Roll no b. Stu_name c. math+mark d. def
24. What is the size of the string ‘Seema\’s pencil’?
a. 15 b. 14 c. 12 d. 13
25. Which of the following are valid real literals?
a. 7 b. 27.0 c. +17/2 d.17,203.50
26. Assertion (A): None literal is used to indicate absence of values.
Reason (R ): It is equal to zero. (Competency based – MCQ)
a. Both (A) and (R ) are correct
b. Both (A) and (R ) are not correct
c. (A) is correct, but (R ) is not correct
d. (A) is not correct, but (R ) is correct
27. Assertion (A): Numeric values with commas are not considered as int or float values..
Reason (R ): Python treats such values as tuples. (Competency based – MCQ)
a. Both (A) and (R ) are correct
b. Both (A) and (R ) are not correct
c. (A) is correct, but (R ) is not correct
d. (A) is not correct, but (R ) is correct
28. Which of the following is an expression in b=a-5?
a. b b. 5 c. a-5 d. b=a-5
29. Which of the following statement is correct?
a. 20=b b. 20-b c. a*2=c d. b=2*a
30. Which of the following functions is used to check the datatype of literals?
a. id() b. datatype() c. dtype() d. type()
31. Which of the following functions is used to get the input from the user?
a. Input() b. get() c. read() d. none of these
32. The output of the following code is
a,b=5,10
print(‘a=’,a,end=’,’)
print(‘b=’,b)
a. 5,10 b. 5 c. 5, d. 10
10 10 5
33. Which of the following is the correct statement?
a. a=input(Enter your name) c. a=input “Enter your name”
b. a=input(Enter your name d. a=input(“Enter your name”)
34. Names given to a part of a program are _____________.
a. identifiers b. keywords c. functions d. literals
35. A __________ is a reserved word carrying special meaning and purpose.
a. identifiers b. keywords c. literals d. functions

Velammal Bodhi Campus – Kumbakonam (Hariharan S, Herold R A)


36. A __________ is a sequence of characters and each character can be individually accessed
using its index.
a. string b. int c. list d. dictionary
37. What is the datatype of the following statement?
a. list b. dictionary c. string d. tuple
38. What is the datatype of the following?
k={‘a’:100, ‘b’:2000, ‘c’:300}
a. List b. tuple c. string d. dictionary
39. Which of the following is not a mutable datatype?
a. int b. list c. dictionary d. sets
40. The value of the expression 7*8/5//2 is (Competency based – MCQ)
a. 5.0 b. 0.0 c. 28.0 d. none of these
41. How many times does the following code execute?

a. 6 b. 1 c. 4 d. 5
42. What will be the output of the following code? (Competency based – MCQ)

a. ‘diain’ b. ‘aidni’ c. ‘iadni’ d. ‘india’


43. Which of the following functions will give the total number of characters in a string?
a. len() b. count() c. length() d. find()
44. Which of the following functions will return the string with all words starting with uppercase
characters and remaining letters in lowercase.
a. lower() b. capitalize() c. title() d. upper()
45. Which of the following functions will return a list containing all words of a string?
a. find() b. partition() c. split() d. index()
46. Which of the following will return the last element in l=[1,2,3,4,5,6]
a. l[6] b. l[0] c. l[5] d. l[-1]
47. Which of the following can delete an element from a list if its value is given?
a. pop() b. del c. remove() d. all of these
48. What will be the output for the following statement? (Competency based – MCQ)
print(type(None))
a. Error b. String c. Nonetype d. NameError
49. Which of the following functions will return the key, value pairs of a dictionary?
a. Keys() b. values() c. items() d. none of these
50. What will be the result of the following code? (Competency based – MCQ)
d1={‘abc’:5, ’def’:6, ’ghi’:7}
print(d1[0])
a. abc b. 5 c. {‘abc’:5} d. error

Velammal Bodhi Campus – Kumbakonam (Hariharan S, Herold R A)

You might also like