MCA 2nd Sem Paper Python
MCA 2nd Sem Paper Python
PART 1
Note : Attempt all Questions. All Question Carry 1 Marks. [CO1 – CO5]
print("ab\tcd\tef".expandtabs())
a) ab cd ef b) abcdef
c) ab\tcd\tef d) ab cd ef
10. What will be the value of the following Python expression?
float(4+int(2.39)%2)
a) 5.0 b) 5
c) 4.0 d) 4
11. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?
a) [3, 4, 5, 20, 5, 25, 1, 3] b) [1, 3, 3, 4, 5, 5, 20, 25]
c) [25, 20, 5, 5, 4, 3, 3, 1] d) [3, 1, 25, 5, 20, 5, 4, 3]
12. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?
a) [3, 4, 5, 20, 5, 25, 1, 3] b) [1, 3, 3, 4, 5, 5, 20, 25]
c) [3, 5, 20, 5, 25, 1, 3] d) [1, 3, 4, 5, 20, 5, 25]
16. Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
a) d.size() b) len(d)
c) size(d) d) d.len()
21. _____ represents an entity in the real world with its identity and behaviour.
a) A method b) An object
c) A class d) An operator
26. What are the methods which begin and end with two underscore characters called?
a) Special methods b) In-built methods
c) User-defined methods d) Additional methods
PART- 2
NOTE: Attempt Five Question at least One Question from Each Section. All Question Carry Equal
Marks.
SECTION-A (CO1)
Q 1. What is Python? What are the benefits of using Python. and State any six applications of python.
Q 2. What is an Interpreted language? What is built-in functions in Python?
SECTION-B (CO2)
Q 3. What are lists and tuples? What is the key difference between the two? What is index variable?
Q 4. What is the difference between Python Arrays and lists? What is Nested Lists?
SECTION-C (CO3)
Q 5. What is meant by module in python? List some built in modules in python.
Q 6. How does inheritance work in python? Explain it with an example.
SECTION-D (CO4)
Q 7. Explain any six arithmetic operators of python with suitable examples of each
Q 8. Explain while loop & for loop with syntax and example in detail. What is the difference between range
and xrange?
SECTION-E (CO5)
Q 9. Explain map ,reduce and filter in Python
Q 10. What is a linked list? What are the different types of linked lists? Also write down the advantage of
Linked List?
PART 1
Note : Attempt all Questions. All Question Carry 1 Marks. [CO1 – CO5]
2**(3**2)
(2**3)**2
2**3**2
a) 512, 64, 512 b) 512, 512, 512
c) 64, 512, 64 d) 64, 64, 64
13. What will be the output of the following Python code snippet?
14. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
a) [3, 4, 5, 20, 5, 25, 1] b) [1, 3, 3, 4, 5, 5, 20, 25]
c) [3, 5, 20, 5, 25, 1, 3] d) [1, 3, 4, 5, 20, 5, 25]
>>>"Welcome to Python".split()
a) [“Welcome”, “to”, “Python”] b) (“Welcome”, “to”, “Python”)
c) {“Welcome”, “to”, “Python”} d) “Welcome”, “to”, “Python”
16. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5])?
a) [3, 4, 5, 20, 5, 25, 1, 3, 34, 5] b) [1, 3, 3, 4, 5, 5, 20, 25, 34, 5]
c) [25, 20, 5, 5, 4, 3, 3, 1, 34, 5] d) [1, 3, 4, 5, 20, 5, 25, 3, 34, 5]
28. The assignment of more than one function to a particular operator is _______
a) Operator over-assignment b) Operator overriding
c) Operator overloading d) Operator instance
33. Operators with the same precedence are evaluated in which manner?
a) Left to Right b) Right to Left
c) Can’t say d) None of the mentioned
PART- 2
NOTE: Attempt Five Question at least One Question from Each Section. All Question Carry Equal
Marks.
SECTION-A (CO1)
Q 1. What is an Interpreted language? What is built-in functions in Python?
Q 2. Explain data type in Python with examples.
SECTION-B (CO2)
Q 3. Explain mutable and immutable data types with example in python.
Q 4. Explain the exception handling in Python. List out keywords used in exception handling.
SECTION-C (CO3)
Q 5. What is built-in functions in Python? Differentiate between append() and extend().
Q 6. Explain while loop & for loop with syntax and example in detail. What is the difference between range
and xrange?
SECTION-D (CO4)
Q 7. Explain any six arithmetic operators of python with suitable examples of each
Q 8. Explain map ,reduce and filter in Python
SECTION-E (CO5)
Q 9. Explain Inheritance in python with example.
Q 10. What is a stack? What are the operations performed on a stack? What are the applications of a
stack?
PART 1
Note : Attempt all Questions. All Question Carry 1 Marks. [CO1 – CO5]
2**(3**2)
(2**3)**2
2**3**2
a) 512, 64, 512 b) 512, 512, 512
c) 64, 512, 64 d) 64, 64, 64
print("abcdef".find("cd"))
a) True b) 2
c) 3 d) None of the mentioned
11. What will be the output of the following Python code snippet?
print("ab\tcd\tef".expandtabs())
a) ab cd ef b) abcdef
c) ab\tcd\tef d) ab cd ef
float(4+int(2.39)%2)
a) 5.0 b) 5
c) 4.0 d) 4
14. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?
a) [3, 4, 5, 20, 5, 25, 1] b) [1, 3, 3, 4, 5, 5, 20, 25]
c) [3, 5, 20, 5, 25, 1, 3] d) [1, 3, 4, 5, 20, 5, 25]
>>>"Welcome to Python".split()
a) [“Welcome”, “to”, “Python”] b) (“Welcome”, “to”, “Python”)
c) {“Welcome”, “to”, “Python”} d) “Welcome”, “to”, “Python”
20. Suppose d = {“john”:40, “peter”:45}. To obtain the number of entries in dictionary which command do we use?
a) d.size() b) len(d)
c) size(d) d) d.len()
21. What is the value of x if x = math.sqrt(4)?
a) 2 b) 2.0
c) (2, -2) d) (2.0, -2.0)
24. The assignment of more than one function to a particular operator is _______
a) Operator over-assignment b) Operator overriding
c) Operator overloading d) Operator instance
26. What are the methods which begin and end with two underscore characters called?
a) Special methods b) In-built methods
c) User-defined methods d) Additional methods
27. In file handling, what does this terms means “r, a”?
a) read, append b) append, read
c) write, append d) none of the mentioned
PART- 2
NOTE: Attempt Five Question at least One Question from Each Section. All Question Carry Equal
Marks.
SECTION-A (CO1)
Q 1. What is Python? What are the benefits of using Python. and State any six applications of python.
Q 2. What is an Interpreted language? What is built-in functions in Python?
SECTION-B (CO2)
Q 3. What are lists and tuples? What is the key difference between the two? What is index variable?
Q 4. Explain mutable and immutable data types with example in python.
SECTION-C (CO3)
Q 5. What is meant by module in python? List some built in modules in python.
Q 6. Explain while loop & for loop with syntax and example in detail. What is the difference between range
and xrange?
SECTION-D (CO4)
Q 7. Explain any six arithmetic operators of python with suitable examples of each
Q 8. Explain Inheritance in python with example.
SECTION-E (CO5)
Q 9. What is a stack? What are the operations performed on a stack? What are the applications of a stack?
Q 10. What is a linked list? What are the different types of linked lists? Also write down the advantage of
Linked List?