0% found this document useful (0 votes)
5 views2 pages

Selfstudys Com File

The document is a Python revision tour focusing on strings, lists, tuples, and dictionaries, containing a series of questions and answers. Each question tests knowledge of Python data types, operations, and syntax, with a corresponding answer key provided. The questions are designed for basic understanding and are worth one mark each.

Uploaded by

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

Selfstudys Com File

The document is a Python revision tour focusing on strings, lists, tuples, and dictionaries, containing a series of questions and answers. Each question tests knowledge of Python data types, operations, and syntax, with a corresponding answer key provided. The questions are designed for basic understanding and are worth one mark each.

Uploaded by

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

Python Revision Tour – II (String, List, Tuple and Dictionary)

(From this portion as per sample paper all the Questions are of 1 mark)
• As basic questions will be asked from this portion so all the question

Q1. Following set of commands is executed in Python shell ,what will be the output ?
>>>str=”welcome”
>>>str[:3]
(a) wel (b) ome (c) wce (d) welcome

Q2. What is the data type for the object L below in python?
L=1,4,’thanks’,34
(a) list (b) dictionary (c) tuple (d) array

Q3. To store value in terms of key and value , what core data type does Python provide?
(a) List (b) tuple (c) class (d) dictionary

Q4. Suppose str=’welcome’


All the following expression produce the same result except one. Which one?
(a) str[ : : -6] (b) str[ : : -1][ : : -6] (c) str[ : :6] (d) str[0] + str[-1]

Q5. What is the output of the following code segment?


str1=”hello”
str2=”world”
print(str1+str2.upper())
(a) helloworld (b) HELLOWORLD
(c) helloWORLD (d) HELLO WORLD

Q6. Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following is
incorrect?
a) print(T[1])
b) T[2] = -29
c) print(max(T))
d) print(len(T))

Q7. Identify the valid declaration of L:


L = [‘hello’, ’28.6’, ‘world’, ’13’]

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

Q8. If the following code is executed, what will be the output of the following code?
name="ComputerSciencewithPython"
print(name[3:10])
Q9. A tuple is declared as
T = (12,4,7,8,5)
What will be the value of sum(T)

Q10. To store in terms of key and value, what core data type does python provide?
(a) list (b) tuple (c) class (d) dictionary

Q11. Write a statement in Python to declare a dictionary whose keys are 1, 2, 3 and values
are January, February and March respectively.
Q12. Given the lists L=[10,30,16,8,50,17,12,42] , write the output of print(L[2:5])

Q13. Write the output of the following code


T= (10,30,15,20,25)
print(max(T))
print(min(T))

Q14. Write the output of the following code


T=(‘p’,’q’,’r’,’P’,’Q’)
print(max(T))
print(min(T))

Q15. Write the output of the following code


L=[‘cs’,’maths’,’phy’,’chem’,’eng’]
print(len(L))

Q16. Which of the following is wrong dictionary declaration?


(a) d= {“mon” : 1, “tue” : 2, “wed” : 3}
(b) d= {1 : "mon", 2 : "tue",3 : "wed"}
(c) d= {[1,2] : "hello"}
(d) d= {(1,2) : "hello"}

Answer Key
1.(a) 9. 36
2. (c) 10. (d)
3.(d) 11. Month={1:'january',2:'february',3:'march'}
4.(a) 12. [16, 8, 50]
5(c) 13. 30
10
6.(b) 14. r
P
7.(d) 15. 5
8. puterSc 16.(c)

You might also like