The document provides a list of 25 revision questions on various Python programming concepts like tokens, scopes, functions, conditionals, loops, lists, dictionaries, methods and functions. The questions cover basic as well as advanced topics and include problems on pattern printing, string manipulation, sorting and more.
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 ratings0% found this document useful (0 votes)
11 views3 pages
Revision
The document provides a list of 25 revision questions on various Python programming concepts like tokens, scopes, functions, conditionals, loops, lists, dictionaries, methods and functions. The questions cover basic as well as advanced topics and include problems on pattern printing, string manipulation, sorting and more.
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/ 3
CLASS – 12 Computer Science
Revision Question Bank
1. What are tokens in python? How many types of tokens are allowed in python? Exemplify your answer. 2. How are keywords different from identifiers? 3. What is the difference between del statement and pop ( )function. 4. What do you understand by local and global scope of variables? How can you access a global variable inside the function, if function has a variable with same name? 5. Write the output of the following: a=5 while a>0: print (a) a=a-1 6. Write a program to print the following pattern. A B C D E F G H I J 7. Write a program to accept a string and display string with capital letter of each word. For example, if input string is: welcome to my blog. Output string: Welcome To My Blog. 8. What are tokens in python? How many types of tokens are allowed in python? Exemplify your answer. 9. How are keywords different from identifiers? 10. Evaluate the following expressions: a) 6 * 3 + 4 ** 2 // 5 – 8 b) 10 > 5 and 7 > 12 or not 18 > 3 11 How are following import statements different? (b) from X import * (c) from X import a, b, c 12. Rewrite the following code in Python after removing all syntax errors (s). Underline each correction done in the code. Value = 30 for VAL in range (0, Value) if VAL % 4 == 0: print (VAL * 4) Elseif VAL % 5 == 0: else print(VAL + 10) 13. Predict the outputs of the following programs: a. x = ‘apple, pear, peach, grapefruit’ y = x.split(“ , ”) for z in y: if z < ‘m’: print(str.lower(z)) else: print(str.upper(z)) b. x = ‘one’ y = ‘two’ counter = 0 while counter < len (x): print (x[counter], y[counter]) counter +=1 14. 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() 15. What are immutable and mutable types? List immutable and mutable types of Python. 16. What is a string slice? How is it useful? 17. How are lists different from strings when both are sequences? 18. Write a Python statement to declare a Dictionary named ClassRoll with keys as 1, 2, 3 and corresponding values as ‘Reena’, ‘Rakesh’, ‘Zareen’ respectively. 19. Predict the output of the following code: Numbers = [9, 18, 27, 36] for Num in Numbers: for N in range (1, Num%2): print(N, “#”, end = “ ”) print( ) 20. Write a method in python to display the elements of list thrice if it is a number and display the element terminated with '#' if it is not a number.
For example, if the content of list is as follows:
List = ['41', 'WHEEL', 'PRINCE', '23', '58']
The output should be
414141 WHEEL# PRINCE# 232323 585858 21. Predict the output of the following code snippet. def fun1(x, y): x=x+y y=x-y x=x-y print('a =',x) print('b =',y) a=5 b=3 fun1(a,b) 22. Write a program to create a dictionary containing names of competition winner students as keys and number of their wins as values. 23. Write a function listchange(Arr) in Python, which accepts a list Arr of numbers, the function will replace the even number by value 10 and multiply odd number by 5.
24. Write a Python program to sort a list using Bubble sort.
25. What will be the output of the following code snippet? Values = [ ] for i in range (1, 4): Values.append(i) print (Values) Note : For Multimedia Paper kindly refer Assignment of Unit : 1 from Text book and for MCQ must read Topics of Unit.1