[go: up one dir, main page]

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

Question bank python.docx

This document is a question bank for the Python Development course at Silver Oak University for the academic year 2024-25. It includes a comprehensive list of questions categorized into various topics such as Python basics, string manipulation, data structures, and file handling, along with their respective marks and course outcomes. The questions cover theoretical concepts as well as practical programming tasks.

Uploaded by

Sankliya Mayank
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)
47 views6 pages

Question bank python.docx

This document is a question bank for the Python Development course at Silver Oak University for the academic year 2024-25. It includes a comprehensive list of questions categorized into various topics such as Python basics, string manipulation, data structures, and file handling, along with their respective marks and course outcomes. The questions cover theoretical concepts as well as practical programming tasks.

Uploaded by

Sankliya Mayank
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

Silver Oak University

Silver Oak College of Computer Application


Bachelor of Computer Application

Semester : 3 Academic Year : 2024-25


Subject Name : Python Development Subject Code : 3040243202

Question Bank
Sr.
Question Text Marks CO
No.
1 : Overview of Python, Programming languages
1 What is Python? 2 CO-1
2 Describe the history and evolution of Python. 3

3 List 5 major features of Python and their benefits 4 CO-1

4 How to comment specific line(s) in Python program? 3 CO-1


5 What are the differences between C and Python? 4 CO-1

6 What is the difference between = = and is operator in Python? 3 CO-1

7 Explain in operator in Python with an example. 5 CO-1

8 Explain different types of comments in python 3 CO-1

9 What is indentation in Python? 2 CO-1

10 Write a program to print the sum of 2 user-input numbers. 3 CO-1


11 Differentiate between variables and constants in Python. 4 CO-1
Compare and contrast arithmetic, comparison, and logical CO-1
12 5
operators in Python.
13 Demonstrate user input and output in Python. 5 CO-1
14 Explain implicit and explicit type conversion in Python. 4 CO-1
Write a program to calculate the area of a triangle using user CO-1
15 5
inputs.
16 Explain the structure of for loop in python with suitable example. 4 CO-1
Explain the syntax and functionality of the if_else statement CO-1
17 3
with examples.
18 How is the else statement used with the if statement? 2 CO-1
19 Write a program to check if a given number is even or odd. 3 CO-1
What is the purpose of the while loop in Python? Give an CO-1
20 4
example.
Write a program to print the first 10 natural numbers using a for CO-1
21 5
loop.
22 What is the use of the else and continue statements within loops? 4 CO-1
Explain how an if-elif-else statement works in Python. Write a CO-1
23 Python code that checks if a number is positive, negative, or 5
zero.
Write a Python program that checks if a given year is a leap year CO-1
24 3
or not.

25 Differentiate between for and while loops in Python. Provide 5 CO-1


examples where each loop is more appropriate.
26 Write a Python program to print the Fibonacci sequence up to n 5 CO-1
terms using a loop.
27 Describe break, continue, pass statement with example 4 CO-1

28 Write a python program that finds the factorial of a natural 5 CO-1


number n.
2 : String ,List, Function
29 What is string slicing in Python? 2 CO-2
30 Explain string indexing and slicing. 4 CO-2

Describe following string functions with example: islower(), CO-2


31 5
isupper(),replace(),find(),count()

32 Provide an example to extract a substring from a given string. 3 CO-2


Demonstrate common string operations like concatenation, CO-2
33 5
searching, and replacement.

Explain how the split(),capitalize() and join()methods work in CO-2


34 5
Python. Provide examples for each.

35 “List is mutable.” - Justify with suitable example. 3 CO-2

36 How do you add, remove, and update elements in a Python list? CO-2
Provide examples for each operation.
Demonstrate creating, accessing, and modifying elements in a CO-2
37 4
list.

38 Define a function in Python and explain its scope and argument 4 CO-2
types
How append() and extend() are different with reference to list in
39 4 CO-2
Python?
Explain how the pop(),remove(),reverse()and insert() methods CO-2
40 5
list work in Python. Provide examples for each.
Discuss the scope and lifetime of variables in Python functions CO-2
41 5
with examples.
Explain the difference between return and void functions in CO-2
42 4/5
Python. Provide examples.
Explain the use of following built in function in python. max(), pow(), CO-2
43 4/5
str(), input()

44 What is the purpose of “def” keyword in python? 4 CO-2


45 Explain the conversion of tuple to list in python. 4 CO-2
Write Python Program to Prompt for a Marks in the range of 0 to 100. CO-2
If the entered mark is out of range, it should print an error. If the
entered marks is between 0 and 100, print a grade using following
information:
46 Marks ≥ 70 Grade A 5
60≤Marks <70 Grade B
50≤Marks <60 Grade C
40≤Marks <50 Grade D
Marks<40 Grade FF
47 Write Python code to find and print first n- Fibonacci numbers 4 CO-2

48 Describe range function with example. 4 CO-2

49 Describe user defined function in python 4 CO-2

3 : Tuples and Sets, Dictionary


3
50 How are tuples created in Python? Explain with an example. CO-3

Explain any three basic operations that can be performed on a tuple 3 CO-3
51
with examples.

52 What are sets in Python? How do you create a set? 3 CO-3


53 Give comparison between Tuple and List in python 4 CO-3

54 Given a tuple (10, 20, 30, 40), write a Python code to unpack the 4 CO-3
elements into four variables.
Define key-value pairs in a dictionary and demonstrate access
55 3 CO-3
and modification.
56 Differentiate between lists and dictionaries. 3 CO-3
57 Explain sets in Python and their unique properties. 4 CO-3
58 Differentiate between sets and dictionaries. 3 CO-3
59 Differentiate List and Tuple in Python. 3 CO-3
Consider the list lst=[9,8,7,6,5,4,3]. Write the Python program CO-3
which performs the following operation without using built-in
methods.
1) Insert element 10 at beginning of the list.
60 5
2) Insert element 2 at end of the list.
3) Delete the element at index position 5.
What is dictionary in Python? Explain with an example.
61 Describe any four common set methods with examples. 4 CO-3
Create a set fruit_set with the values {"apple", "banana", CO-3
"cherry"}.Add the value "date" to fruit_set. Print the updated
62 5
fruit_set. Remove the value "banana" from fruit_set. Print the
modified fruit_set.
Create a tuple fruit_tuple with the values ("apple", "banana", CO-3
"cherry"). Access and print the second element of fruit_tuple
using indexing. Extract and print the substring containing
"banana" and "cherry" using slicing.
63 5
Create another tuple more_fruits with the values ("date",
"elderberry"). Concatenate fruit_tuple and more_fruits into a
new tuple all_fruits and print it. Use the len() function to print
the number of elements in all_fruits.
Create a dictionary named person_info with the following keys: CO-3
"name", "age", "occupation", and "hobbies".Populate the
dictionary with values of your choice. "hobbies" should be a list
64 of at least three hobbies. Print the person_info dictionary. Access 5
and print the value associated with the "occupation" key. Update
the "age" value to a new age and print the updated dictionary.
Add a new key-value pair "email" with a value of your choice to
the dictionary and print the updated dictionary.
Create a dictionary named product_prices with at least four CO-3
key-value pairs where the keys are product names (strings) and
the values are their prices (floats). Print the product_prices
65 dictionary. Increase the price of each product by 5% using a for 5
loop and update the dictionary accordingly. Print the updated
dictionary with the new prices. Use the .get() method to safely
access the price of a specific product of your choice and print it.
Discuss the relationship between tuples and dictionaries with CO-3
66 5
examples.
Describe dictionary example in python. How to access CO-3
67 3
individual members?

4 : File Handling
68 Explain the concept of file handling in Python. 3 CO-4
Demonstrate opening, reading, writing, and closing files in
69 4 CO-4
Python.
70 What is the purpose of the with statement in file handling? 3 CO-4
71 Explain Python modules and how to import them into your code. 4 CO-4
Explain modulo operator in python with the help of suitable
72 4 CO-4
example.
73 Explain different mode for opening a file in python 5 CO-4
74 What is the Pickle module used for in Python? 5 CO-4
75 How do you read and write binary files in Python? 4/5 CO-4
76 What are the primary differences between text files and binary files? 4 CO-4
77 How do you create a new text file and write data to it in Python? 3 CO-4
78 What methods can be used to read the contents of a text file? 4 CO-4
79 Which Python methods are commonly used for writing data to a file? 3 CO-4
80 Which Python methods are commonly used for writing data to a file? 4 CO-4
81 How do you read a CSV file into a list of dictionaries using Python? 5 CO-4

You might also like