0% found this document useful (0 votes)
14 views3 pages

Python Programming Exam Questions

The document outlines an exam on Python programming, consisting of a theory part with questions on code output, variable naming, functions, data types, loops, dictionaries, and exception handling. The practical part includes tasks such as counting vowels in a string, filtering even numbers from a list, finding the second largest number, creating a dictionary from user input, and calculating character frequency in a string. Overall, it assesses both theoretical knowledge and practical coding skills in Python.

Uploaded by

namar5629
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)
14 views3 pages

Python Programming Exam Questions

The document outlines an exam on Python programming, consisting of a theory part with questions on code output, variable naming, functions, data types, loops, dictionaries, and exception handling. The practical part includes tasks such as counting vowels in a string, filtering even numbers from a list, finding the second largest number, creating a dictionary from user input, and calculating character frequency in a string. Overall, it assesses both theoretical knowledge and practical coding skills in Python.

Uploaded by

namar5629
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

Exam on Python Programming

Theory Part
1. What is the output of the following code?

2. Which of the following is a valid variable name in Python?

3. What does the len() function do in Python?

4. What is the output of this code?

5. Which data type is immutable in Python?


6. What is the result of this code?

7. What does the range(2, 10, 2) function return?

8. Which keyword is used to define a function in Python?

9. What is the output of the following?

[Link] will this code output?


[Link] the different types of loops in Python with examples.
[Link] are functions in Python? How do you define and call a function?
[Link] is a dictionary in Python? How is it different from a list?
[Link] the concept of exception handling in Python with example.
[Link] is the difference between is and == in Python?

Practical

[Link] a Python program to count the number of vowels in a string.

[Link] a Python function that takes a list of numbers and returns a new list with
only the even numbers.

[Link] a Python program to find the second largest number in a list.

[Link] a dictionary from user input where keys are words and values are their
lengths.
(Example: input = "cat dog rabbit" → output = {'cat': 3, 'dog': 3, 'rabbit': 6})

[Link] a Python function to return the frequency of each character in a string,


ignoring spaces and case.

You might also like