0% found this document useful (0 votes)
122 views

MCA 2nd Sem Paper Python

This document is an examination paper for the MCA program at Mewar University, focusing on Python Programming. It consists of multiple-choice questions and descriptive questions divided into sections, covering various Python concepts such as data types, functions, operators, and modules. The exam is structured to assess students' understanding of Python programming fundamentals and practical applications.

Uploaded by

Anuradha Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

MCA 2nd Sem Paper Python

This document is an examination paper for the MCA program at Mewar University, focusing on Python Programming. It consists of multiple-choice questions and descriptive questions divided into sections, covering various Python concepts such as data types, functions, operators, and modules. The exam is structured to assess students' understanding of Python programming fundamentals and practical applications.

Uploaded by

Anuradha Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 12

MEWAR UNIVERSITY, CHITTORGARH SET-1

DEPARTMENT OF COMPUTER APPLICATION


END TERM EXAMINATION: APR-2025
COURSE : MCA
YEAR : 1st SEM : 2nd

PAPER NAME & CODE : [MCS-201] & Python Programming

MAX MARKS: 85 TIME : 3:00 HRS

PART 1

Note : Attempt all Questions. All Question Carry 1 Marks. [CO1 – CO5]

1. Which of the following is the correct extension of the Python file?


a) .python b) .pl
c) .py d) .p

2. Is Python code compiled or interpreted?


a) Python code is both compiled and interpreted
b) Python code is neither compiled nor interpreted
c) Python code is only compiled
d) Python code is only interpreted

3. What is the order of precedence in python?


a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Addition, Division, Subtraction
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
4. What will be the output of the following Python code snippet if x=1?
x<<2
a) 4 b) 2
c) 1 d) 8

5. Which of the following is the funcation division operator in Python?


a) | b) //
c) / d) %
6. What are the two main types of functions in Python?
a) System function b) Custom function
c) Built-in function & User defined function d) User function

7. Which one of these is floor division?


a) / b) //
c) % d) None of the mentioned
8. 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

9. What will be the output of the following Python code?

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]

13. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)?


a) 0 b) 4
c) 1 d) 2

14. Which of the following is a Python tuple?


a) [1, 2, 3] b) (1, 2, 3)
c) {1, 2, 3} d) {}

15. Which of the following statements create a dictionary?


a) d = {} b) d = {“john”:40, “peter”:45}
c) d = {40:”john”, 45:”peter”} d) All of the mentioned

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()

17. What is returned by math.ceil(3.4)?


a) 3 b) 4
c) 4.0 d) 3.0

18. What is the value returned by math.floor(3.4)?


a) 3 b) 4
c) 4.0 d) 3.0

19. What is the value of x if x = math.sqrt(4)?


a) 2 b) 2.0
c) (2, -2) d) (2.0, -2.0)

20. What does math.sqrt(X, Y) do?


a) calculate the Xth root of Y b) calculate the Yth root of X
c) error d) return a tuple with the square root of X and Y

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

22. _____ is used to create an object.


a) class b) constructor
c) User-defined functions d) In-built functions

23. What is setattr() used for?


a) To access the attribute of the object b) To set an attribute
c) To check if an attribute exists or not d) To delete an attribute
24. Which of the following is not a class method?
a) Non-static b) Static
c) Bounded d) Unbounded
25. 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

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. Which of the following mode will refer to binary data?


a) r b) w
c) + d) b

28. How do you rename a file?


a) fp.name = ‘new_name.txt’
b) os.rename(existing_name, new_name)
c) os.rename(fp, new_name)
d) os.set_name(existing_name, new_name)

29. What is the output of this expression, 3*1**3?


a) 27 b) 9
c) 3 d) 1

30. To insert 5 to the third position in list1, we use which command?


a) list1.insert(3, 5) b) list1.insert(2, 5)
c) list1.add(3, 5) d) list1.append(3, 5)

31. Which of these definitions correctly describes a module?


a) Denoted by triple quotes for providing the specification of certain program elements
b) Design and implementation of specific functionality to be incorporated into a program
c) Defines the specification of how it is to be used
d) Any program that reuses code

32. Which of the following is not an advantage of using modules?


a) Provides a means of reuse of program code
b) Provides a means of dividing up tasks
c) Provides a means of reducing the size of the program
d) Provides a means of testing individual parts of the program

33. What will be the output of the following Python code?


>>> a=("Check")*3
>>> a
a) (‘Check’,’Check’,’Check’) b) * Operator not valid for tuples
c) (‘CheckCheckCheck’) d) Syntax error

34. What will be the output of the following Python code?


>>> a=(1,2)
>>> b=(3,4)
>>> c=a+b
>>> c
a) (4,6) b) (1,2,3,4)
c) Error as tuples are immutable d) None

35. What will be the output of the following Python code?


>>> a=[(2,4),(1,2),(3,9)]
>>> a.sort()
>>> a
a) [(1, 2), (2, 4), (3, 9)] b) [(2,4),(1,2),(3,9)]
c) Error because tuples are immutable d) Error, tuple has no sort attribute

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?

MEWAR UNIVERSITY, CHITTORGARH SET-2


DEPARTMENT OF COMPUTER APPLICATION
END TERM EXAMINATION: APR-2025
COURSE : MCA
YEAR : 1st SEM : 2nd

PAPER NAME & CODE : [MCS-201] & Python Programming

MAX MARKS: 85 TIME : 3:00 HRS

PART 1

Note : Attempt all Questions. All Question Carry 1 Marks. [CO1 – CO5]

1. Which keyword is used for function in Python language?


a) Function b) def
c) Fun d) Define

2. Which of the following character is used to give single-line comments in Python?


a) // b) #
c) ! d) /*

3. What is the order of precedence in python?


a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Addition, Division, Subtraction
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
4. What will be the output of the following Python code snippet if x=1?
x<<2
a) 4 b) 2
c) 1 d) 8

5. What does pip stand for python?


a) Pip Installs Python b) Pip Installs Packages
c) Preferred Installer Program d) All of the mentioned
6. What are the values of the following Python expressions?

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

7. Which of the following is the truncation division operator in Python?


a) | b) //
c) / d) %
8. What are the two main types of functions in Python?
a) System function b) Custom function
c) Built-in function & User defined function d) User function

9. Is Python case sensitive when dealing with identifiers?


a) yes b) no
c) machine dependent d) none of the mentioned
10. Which of the following is an invalid variable?
a) my_string_1 b) 1st_string
c) foo d) _

11. Which is the correct operator for power(xy)?


a) x^y b) x**y
c) x^^y d) None of the mentioned
12. Which one of these is floor division?
a) / b) //
c) % d) None of the mentioned

13. What will be the output of the following Python code snippet?

print('xyyxyyxyxyxxy'.replace('xy', '12', 100))


a) xyyxyyxyxyxxy
b) 12y12y1212x12
c) none of the mentioned
d) error

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]

15. What will be the output of the following Python code?

>>>"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]

17. Suppose t = (1, 2, 4, 3), which of the following is incorrect?


a) print(t[3]) b) t[3] = 45
c) print(max(t)) d) print(len(t))

18. What is returned by math.ceil(3.4)?


a) 3 b) 4
c) 4.0 d) 3.0

19. What is the value returned by math.floor(3.4)?


a) 3 b) 4
c) 4.0 d) 3.0

20. What is the value of x if x = math.factorial(0)?


a) 0 b) 1
c) error d) none of the mentioned

21. What is math.factorial(4.0)?


a) 24 b) 1
c) error d) none of the mentioned

22. What is the value returned by math.fact(6)?


a) 720 b) 6
c) [1, 2, 3, 6] d) error
23. What does the function math.frexp(x) return?
a) a tuple containing the mantissa and the exponent of x
b) a list containing the mantissa and the exponent of x
c) a tuple containing the mantissa of x
d) a list containing the exponent of x

24. What is the result of math.trunc(3.1)?


a) 3.0 b) 3
c) 0.1 d) 1

25. What is the default base used when math.log(x) is found?


a) e b) 10
c) 2 d) none of the mentioned

26. What is returned by int(math.pow(3, 2))?


a) 6 b) 9
c) error, third argument required d) error, too many arguments

27. What is getattr() used for?


a) To access the attribute of the object b) To delete an attribute
c) To check if an attribute exists or not d) To set an attribute

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

29. What is the pickling?


a) It is used for object serialization b) It is used for object deserialization
c) None of the mentioned d) All of the mentioned

30. What is unpickling?


a) It is used for object serialization b) It is used for object deserialization
c) None of the mentioned d) All of the mentioned

31. How do you rename a file?


a) fp.name = ‘new_name.txt’
b) os.rename(existing_name, new_name)
c) os.rename(fp, new_name)
d) os.set_name(existing_name, new_name)

32. What is the output of this expression, 3*1**3?


a) 27 b) 9
c) 3 d) 1

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

34. Which of these definitions correctly describes a module?


a) Denoted by triple quotes for providing the specification of certain program elements
b) Design and implementation of specific functionality to be incorporated into a program
c) Defines the specification of how it is to be used
d) Any program that reuses code

35. What will be the output of the following Python code?


>>> a=("Check")*3
>>> a
a) (‘Check’,’Check’,’Check’) b) * Operator not valid for tuples
c) (‘CheckCheckCheck’) d) Syntax error

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?

MEWAR UNIVERSITY, CHITTORGARH SET-3


DEPARTMENT OF COMPUTER APPLICATION
END TERM EXAMINATION: APR-2025
COURSE : MCA
YEAR : 1st SEM : 2nd

PAPER NAME & CODE : [MCS-201] & Python Programming

MAX MARKS: 85 TIME : 3:00 HRS

PART 1

Note : Attempt all Questions. All Question Carry 1 Marks. [CO1 – CO5]

1. What will be the value of the following Python expression?


4+3%5
a) 7 b) 2
c) 4 d) 1
2. Is Python case sensitive when dealing with identifiers?
a) no b) yes
c) machine dependent d) none of the mentioned
3. What does pip stand for python?
a) Pip Installs Python b) Pip Installs Packages
c) Preferred Installer Program d) All of the mentioned
4. What are the values of the following Python expressions?

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

5. Which of the following is not a keyword?


a) eval b) assert
c) nonlocal d) pass
6. Which of the following is an invalid statement?
a) abc = 1,000,000
b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000
d) a_b_c = 1,000,000
7. Which is the correct operator for power(xy)?
a) x^y b) x**y
c) x^^y d) None of the mentioned
8. Which one of these is floor division?
a) / b) //
c) % d) None of the mentioned
9. What is the output of this expression, 3*1**3?
a) 27 b) 9
c) 3 d) 1
10. What will be the output of the following Python code?

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('xyyxyyxyxyxxy'.replace('xy', '12', 100))


a) xyyxyyxyxyxxy
b) 12y12y1212x12
c) none of the mentioned
d) error

12. What will be the output of the following Python code?

print("ab\tcd\tef".expandtabs())
a) ab cd ef b) abcdef
c) ab\tcd\tef d) ab cd ef

13. 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

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]

15. What will be the output of the following Python code?

>>>"Welcome to Python".split()
a) [“Welcome”, “to”, “Python”] b) (“Welcome”, “to”, “Python”)
c) {“Welcome”, “to”, “Python”} d) “Welcome”, “to”, “Python”

16. To add a new element to a list we use which command?


a) list1.add(5) b) list1.append(5)
c) list1.addLast(5) d) list1.addEnd(5)

17. To insert 5 to the third position in list1, we use which command?


a) list1.insert(3, 5) b) list1.insert(2, 5)
c) list1.add(3, 5) d) list1.append(3, 5)

18. Suppose t = (1, 2, 4, 3), which of the following is incorrect?


a) print(t[3]) b) t[3] = 45
c) print(max(t)) d) print(len(t))

19. Which of the following statements create a dictionary?


a) d = {} b) d = {“john”:40, “peter”:45}
c) d = {40:”john”, 45:”peter”} d) All of the mentioned

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)

22. What does math.sqrt(X, Y) do?


a) calculate the Xth root of Y b) calculate the Yth root of X
c) error d) return a tuple with the square root of X and Y

23. What is getattr() used for?


a) To access the attribute of the object b) To delete an attribute
c) To check if an attribute exists or not d) To set an attribute

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

25. Which of the following is not a class method?


a) Non-static b) Static
c) Bounded d) Unbounded

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

28. Which function is used to read all the characters?


a) Read() b) Readcharacters()
c) Readall() d) Readchar()

29. How do you delete a file?


a) del(fp) b) fp.delete()
c) os.remove(‘file’) d) os.delete(‘file’)

30. How do you rename a file?


a) fp.name = ‘new_name.txt’
b) os.rename(existing_name, new_name)
c) os.rename(fp, new_name)
d) os.set_name(existing_name, new_name)

31. What is the order of precedence in python?


a) Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
b) Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
c) Parentheses, Exponential, Multiplication, Addition, Division, Subtraction
d) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

32. Which of these definitions correctly describes a module?


a) Denoted by triple quotes for providing the specification of certain program elements
b) Design and implementation of specific functionality to be incorporated into a program
c) Defines the specification of how it is to be used
d) Any program that reuses code

33. Which of the following is not an advantage of using modules?


a) Provides a means of reuse of program code
b) Provides a means of dividing up tasks
c) Provides a means of reducing the size of the program
d) Provides a means of testing individual parts of the program

34. What will be the output of the following Python code?


>>> a=("Check")*3
>>> a
a) (‘Check’,’Check’,’Check’) b) * Operator not valid for tuples
c) (‘CheckCheckCheck’) d) Syntax error

35. What will be the output of the following Python code?


>>> a=[(2,4),(1,2),(3,9)]
>>> a.sort()
>>> a
a) [(1, 2), (2, 4), (3, 9)] b) [(2,4),(1,2),(3,9)]
c) Error because tuples are immutable d) Error, tuple has no sort attribute

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?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy