0% found this document useful (0 votes)
3 views6 pages

Python Quiz

The document is a Python quiz consisting of multiple-choice and programming questions, with all questions being compulsory and carrying equal marks. It includes questions on control structures, dictionary operations, and programming tasks such as adding dictionary values and removing duplicates. Participants are required to provide their enrollment number and name at the beginning of the quiz.

Uploaded by

Vimal Vajpeyi
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)
3 views6 pages

Python Quiz

The document is a Python quiz consisting of multiple-choice and programming questions, with all questions being compulsory and carrying equal marks. It includes questions on control structures, dictionary operations, and programming tasks such as adding dictionary values and removing duplicates. Participants are required to provide their enrollment number and name at the beginning of the quiz.

Uploaded by

Vimal Vajpeyi
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/ 6

4/24/24, 9:59 AM Python Quiz

Python Quiz
All questions are compulsory and carry equal marks. There is no negative marking.

* Indicates required question

1. Enrollment Number: *

2. Name *

3. In a Python program, a control structure: * 1 point

Mark only one oval.

Defines program-specific data structures

Directs the order of execution of the statements in the program

Manages the input and output of control characters

Dictates what happens before the program starts and after it terminates

https://docs.google.com/forms/d/1m_vvGc8iSRselXxYdxyvWWcaYVec65PRRLyN1HgmthU/edit 1/6
4/24/24, 9:59 AM Python Quiz

4. What is the output of the following code snippet: * 1 point

Mark only one oval.

1234

124

It doesn’t generate any output.

5. Which of the following are true of Python dictionaries: * 1 point

Mark only one oval.

All the keys in a dictionary must be of the same type.

Dictionaries can be nested to any depth.

A dictionary can contain any object type except another dictionary

Items are accessed by their position in a dictionary.

6. Consider this dictionary: d ={‘first’: 1, 'second': 2, 'third': 3} What is the * 1 point


result of this statement: d['bar':'baz']

Mark only one oval.

200 300

It raises an exception

[200, 300]

(200, 300)

https://docs.google.com/forms/d/1m_vvGc8iSRselXxYdxyvWWcaYVec65PRRLyN1HgmthU/edit 2/6
4/24/24, 9:59 AM Python Quiz

7. Consider again this nested structure definition: The statement 'z' in x[2] is * 2 points

True or False?

Mark only one oval.

True

False

8. What method call will delete the entry whose value is 200 from this * 2 points

dictionary: d ={‘first’: 100, 'second': 200, 'third': 300}

Mark only one oval.

del d[‘second’]

del d(‘second’)

d.pop(‘second’)

remove d(‘second’)

https://docs.google.com/forms/d/1m_vvGc8iSRselXxYdxyvWWcaYVec65PRRLyN1HgmthU/edit 3/6
4/24/24, 9:59 AM Python Quiz

9. What is the value of the expression 4 + 3 ** 2 * 1? * 1 point

Mark only one oval.

33

14

13

36

10. Write a program to add values of same keys of two dictionary * 2 points

d1 = {'a':100, 'b': 200, 'c':300}


d2 = {'a':300, 'b':100, 'd':400}

Output:
{'a':400, 'b': 300, 'c': 300, 'd':400}

11. Write a program to print mirror characters in a string after nth position 2 points

I/P: N =3
paradox
O/P
paizwlc

https://docs.google.com/forms/d/1m_vvGc8iSRselXxYdxyvWWcaYVec65PRRLyN1HgmthU/edit 4/6
4/24/24, 9:59 AM Python Quiz

12. Write a Python program to create all possible strings by using 'a', 'e', 'i', 'o', 'u'.
Use the characters exactly once

13. Write a Python program to get the maximum and minimum value in a 1 point
dictionary.

14. Write a function that takes a number as an input parameter and returns 1 point

the corresponding number name in words. For example: if input is 452,


the function should return “Four Five Two”. Use a dictionary for mapping
digits to their string representation.

https://docs.google.com/forms/d/1m_vvGc8iSRselXxYdxyvWWcaYVec65PRRLyN1HgmthU/edit 5/6
4/24/24, 9:59 AM Python Quiz

15. Write a program to remove duplicates values across dictionary values 5 points

I/P: dict1 = {'A', [1], 'B': [8,9,1]}

O/P: {'A': [], 'B':[8,9]}

This content is neither created nor endorsed by Google.

Forms

https://docs.google.com/forms/d/1m_vvGc8iSRselXxYdxyvWWcaYVec65PRRLyN1HgmthU/edit 6/6

You might also like