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

Python Exam for CS Students

The document outlines the model examination for B. Sc. in Computer Science at Dr. R. K. Shanmugam College of Arts and Science, focusing on Python Programming. It includes sections for multiple-choice questions, short answer questions, and detailed explanations, covering various topics such as dictionaries, functions, control flow, and file operations. The exam is structured into three parts with a total of 75 marks and a duration of 3 hours.
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)
96 views2 pages

Python Exam for CS Students

The document outlines the model examination for B. Sc. in Computer Science at Dr. R. K. Shanmugam College of Arts and Science, focusing on Python Programming. It includes sections for multiple-choice questions, short answer questions, and detailed explanations, covering various topics such as dictionaries, functions, control flow, and file operations. The exam is structured into three parts with a total of 75 marks and a duration of 3 hours.
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

DR. R. K.

SHANMUGAM COLLEGE OF ARTS AND SCIENCE, KALLAKURICHI


MODEL EXAMINATION – 2024
Register Number:
Name of the Candidate: Date:
College Code: 302 Max. Marks: 75
Programme Code & Name : 214 & B. Sc., Computer Science Time: 3 Hrs
Course Code & Name: 23UCSCC13 & Python Programming

Part – A 10 x 1 = 10 Marks
(Answer ALL Questions)
1. Define Dictionaries.
2. Who developed Python Programming Language?
a) Wick van Rossum b) Rasmus Lerdorf
c) Guido van Rossum d) Niene Stom
3. What will be the value of ‘result’ in following Python program?
list1 = [1,2,3,4]
list2 = [2,4,5,6]
list3 = [2,6,7,8]
result = list()
[Link](i for i in list1 if i not in (list2+list3) and i not in result)
[Link](i for i in list2 if i not in (list1+list3) and i not in result)
[Link](i for i in list3 if i not in (list1+list2) and i not in result)
a) [1, 3, 5, 7, 8] b) [1, 7, 8] c) [1, 2, 4, 7, 8] d) error
4. Match the following
List – I List – II
A Function Keyword 1 Preferred Installer Program
B pip 2 Remainder
C bytes, bytearray 3 def
D % operator returns 4 Binary Types

A B C D A B C D
(A) 1 2 3 4 (B) 4 2 1 3
(C) 4 1 2 3 (D) 3 1 4 2

5. Match the following


A: list 1. read() and write()
B: key functions 2. mode
C: open an existing file 3. insert()
D:
(A) X:3, Y:1, Z: 2 (B) X:1, Y: 2, Z: 3
(C) X:3, Y:2, Z: 1 (D) X:2, Y:1, Z:3

6. Explain the Dictionaries.

7. Select which the following shows the types of function calls in Python:
a) Call by value b) Call by reference c) Both A and B

(1/2)
8. Describe a Deleting Elements in a tuple

9. Explain writelines() method.

10. Elucidate the append() method

Part – B 5 x 7 = 35 Marks

Answer ALL Questions

11. (a) Write a short note on sets and list


(OR)
(b) Explain max (), min (), len(), pow(), sum(), functions with an example.

12. (a) Explain the syntax of the following statements


For loop, while loop, if - else, if-elif-else
(OR)
(b) Explain in detail about Control flow structures in python.

13. (a) Explain Modules and import statement


(OR)
(b) Write a short note on Namespace and scope.

14. (a) Give the differences between lists and dictionary.


(OR)
(b) Write a short note on Basic list operations

15. (a) Write a short note on Types of files in Python


(OR)
(b) Explain about Reading and Writing files

Part – C 3 x 10 = 30 Marks

Answer ANY THREE Questions

16. Explain about Python Arrays Processing and methods.

17. Explain in detail about the Jump Statements.

18. Describe the Function Arguments.

19. Give a detailed note on list Updating, Nested lists, Basic list operations and Methods.

20. Describe the detail about Renaming and deleting files

(2/2)

Common questions

Powered by AI

Namespaces are containers for mapping names to objects, ensuring variable and function names do not collide. Scope determines the visibility of namespaces, with local, enclosing, global, and built-in scopes being the hierarchy. Variables are accessed according to this order, impacting how modules manage internal and external variable names .

Dictionaries store data in key-value pairs and allow for fast lookup based on a key, while lists store data in a sequential order where each element is accessed by its position index. Lists are useful for ordered collections and iteration, whereas dictionaries are optimized for retrieving data when the exact key is known .

Tuples are immutable, meaning their elements cannot be deleted or changed once assigned, unlike lists, which are mutable and allow for operations like insertion and deletion of elements. This immutability makes tuples generally more appropriate for fixed collections of items .

Lists can be updated through methods like 'append()', 'extend()', 'insert()', and using index assignments. Nested lists contain other lists, and operations may require iterative approaches or nested loops to access elements. The complexity of nested lists adds a layer of abstraction influencing operations and updates .

Python primarily deals with text and binary files. The 'open' function in Python can be used to open a file in different modes such as 'read', 'write', and 'append'. It returns a file object which can be used to interact with the file using various methods like 'read()' and 'write()' .

These functions perform basic operations: 'max()' returns the largest item, 'min()' the smallest, 'len()' returns the number of items, 'pow()' raises a number to a power, and 'sum()' returns the sum of all items in an iterable. Example: 'max([1, 2, 3])' returns 3, 'min([1, 2, 3])' returns 1, 'len([1, 2, 3])' returns 3, 'pow(2, 3)' returns 8, 'sum([1, 2, 3])' returns 6 .

'pip' stands for Preferred Installer Program, which is the package installer for Python. It allows users to install and manage additional libraries and dependencies that are not part of the standard Python library, facilitating easy distribution and installation of Python software .

Python uses 'call by object reference', which means that values (objects) are passed by reference. Mutable objects like lists can be changed inside a function, impacting the original object, whereas immutable objects like integers cannot be altered. This behavior resembles 'call by reference' for mutable objects and 'call by value' for immutable objects .

Jump statements like 'break', 'continue', and 'pass' control the flow of loops by altering or skipping iteration sequences. 'break' ends the loop, 'continue' skips to the next iteration, and 'pass' acts as a placeholder for future code without influencing control flow .

'For loops' iterate over items of a collection, 'while loops' continue until a condition is no longer true. 'If-else' and 'if-elif-else' structures execute blocks of code based on conditions, where 'if-else' provides a binary choice, and 'if-elif-else' allows for multiple conditions to be checked sequentially .

You might also like