Python Part 1 Exam Questions (1-65) ,
with Complete Solutions
1. What is the output of print(list[2:]) if list=[ 'abcd',786, 2.23]? - ANSWERS-
[2.23]
2. What is the output of print (tinylist * 2) if tinylist = [123, 'john']? -
ANSWERS-[123, 'john',123, 'john']
3. Which of the following is correct about tuples in Python? - ANSWERS-***
4. What is the output of print(myTuple) if myTuple = ('abcd',786,2.23)? -
ANSWERS-('abcd',786,2.23)
5. What is the output of print(myTuple[1:3]) if myTuple=('abcd',786,2.23)? -
ANSWERS-(786, 2.23)
6. What is the output of print (myTuple[0]) if myTuple = ('abcd',786,2.23)? -
ANSWERS-abcd
7. Which function obtains all the keys from a dictionary? - ANSWERS-keys()
8. Which function obtains all the values from a dictionary? - ANSWERS-
values()
9. Which function converts a string to an int ? - ANSWERS-int("string")