[go: up one dir, main page]

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

Section A

Uploaded by

ShaharyarSheikh
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)
20 views2 pages

Section A

Uploaded by

ShaharyarSheikh
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

End Term Exam December 2024

Master of Computer Application [MCA]


[6IMCA303(T)]
[PYTHON PROGRAMMING]
TIME: 3:00 Hrs. Max: 50
Min: 17
Note: This question paper is divided into three sections. Attempt questions of all
three sections as per given direction. Distribution of Marks is given in each
section.
[Section-A]
Q.1 Objective Type Questions [10 x 1=10 Marks]
[i] What is the default data type of a variable in Python?
[a] Integer [b] Float
[c] String [d] Dynamic (based on assigned value)
[ii] What is the output of the following Python code?

a = 10, b = 20
a, b = b, a
print (a, b)

[a] 10 20 [b] 20 10
[c] 20 20 [d] 10 10
[iii] Which of the following is used to add a comment in Python?
[a] // comment [b] /* comment */
[c] # comment [d] -- comment
[iv] Which of the following is the correct syntax for a Python "if-else"
statement?
[a] if condition { statements }
[b] if condition: statements else: statements
[c] if condition then statements else then statements
[d] if condition: statements else: else_statements
[v] Which of the following is a valid method to add an element to the end of a
list?
[a] append() [b] extend()
[c] insert() [d] add()
[vi] What will be the output of the following Python code?
my_tuple = (1, 2, 3, 4)
print(my_tuple[2])
[a] 1 [b] 2
[c] 3 [d] 4
[vii] Which of the following is used to define a dictionary in Python?
P.T.O
[a] [] [b] ()
[c] {} [d] <>
[viii] Which of the following methods is automatically called when a new
instance of a class is created?
[a] init() [b] call()
[c] str() [d] new()
[ix] What is the correct way to open a file in Python for reading?
[a] open("file.txt", "r") [b] open("file.txt", "w")
[c] open("file.txt", "a") [d] open("file.txt", "rb")
[x] What will be the output of the following Python code?
x=5
while x > 0:
print(x, end=' ')
x -= 1
[a] 5 4 3 2 1 [b] 4 3 2 1 0
[c] 5 4 3 2 [d] Infinite loop
[Section -B]
Short answer type questions [2 X 5 = 10 Marks]

Answer any two Questions.


Q.2 What is the difference between a statement and an expression in Python?
Q.3 What is the purpose of the break and continue statements in Python loops?
Provide an example of each.
Q.4 How is a tuple different from a list in Python?
Q.5 What is inheritance in object-oriented programming (OOP) and how is it
implemented in Python? Provide a brief example.
Q.6 Describe the difference between local and global variables in Python.

[Section -C]
Long answer type questions [3 X 10 = 30 Marks]
Answer any three Questions.
Q.7 Explain the different data types in Python, such as int, float, boolean, string,
and list. Provide examples of how each data type is used in Python.
Q.8 Describe the process of defining and calling functions in Python. Explain
the concepts of function parameters, return values, local and global
variables, and scope with a detailed example.
Q.9 Explain dictionaries in Python. How to create, access, and modify them?
Q.10 Differentiate between while and for loops in Python. Explain with
examples.
Q.11 Discuss control flow statements (if, if-else, if-elif-else) with examples.

P.T.O

You might also like