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

Python Programming KNC 302

This document contains a Python programming exam with 7 sections and multiple choice and long answer questions. The exam tests knowledge of Python programming concepts including: 1) The Python programming cycle, list slicing, importing modules, arrays vs lists, floor division, 'append' vs 'extend', dictionaries, and object-oriented programming. 2) Built-in string functions, palindrome checking, for and while loops, continue/break/pass statements, and number reversal. 3) Unpacking sequences, mutable sequences, list comprehension, lambda functions, and map functions. 4) Argument passing methods, variable length arguments, encapsulation, and inheritance. 5) File handling, the Sieve of E

Uploaded by

Digvijoy Ranjan
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)
264 views

Python Programming KNC 302

This document contains a Python programming exam with 7 sections and multiple choice and long answer questions. The exam tests knowledge of Python programming concepts including: 1) The Python programming cycle, list slicing, importing modules, arrays vs lists, floor division, 'append' vs 'extend', dictionaries, and object-oriented programming. 2) Built-in string functions, palindrome checking, for and while loops, continue/break/pass statements, and number reversal. 3) Unpacking sequences, mutable sequences, list comprehension, lambda functions, and map functions. 4) Argument passing methods, variable length arguments, encapsulation, and inheritance. 5) File handling, the Sieve of E

Uploaded by

Digvijoy Ranjan
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

Printed Pages: 02 Sub Code:KNC-302

Paper Id: 233077 Roll No.

B.TECH.
(SEM III) THEORY EXAMINATION 2022-23
PYTHON PROGRAMMING
Time: 3 Hours Total Marks: 50
Note: Attempt all Sections. If you require any missing data, then choose suitably.

SECTION A

1. Attempt all questions in brief. 1x10 = 10

(a) Explain the Programming Cycle for Python in detail.


(b) Describe the concept of List Slicing with a suitable example.
(c) Show the way to import the module in python.
(d) Differentiate between Python Arrays and lists?
(e) Define floor division with an example.
(f) Explain the difference between 'append' and 'extend' in Python?
(g) What is a dictionary in Python?

2
90

13
(h) What is object-oriented programming (OOP) in Python? Give an example.
_2

(i) What will be the output of the following python code

2.
P2

24
def count1(s):

5.
3D

vowels = "AEIOUaeiou"
count = 0

.5
P2

for c in s:
if c in vowels: 17
Q

|1
count += 1
return count
9

print(count1(‘I love India’))


:1
31

(j) What will be the output of the following code?


list1 = ['M', 'o', 'n', 'k', 'y']
:
13

print("@".join(list1))
3
02

SECTION B
-2

2. Attempt any three of the following: 5x3 = 15


03

(a) Demonstrate five different built in functions used in the string. Write a
1-

program to check whether a string is a palindrome or not.


|2

(b) Explain the following loops with a flow diagram, syntax, and suitable
examples.
I) For II) while
(c) Explain the continue, break, and pass statements with a suitable example.
(d) Develop a program to calculate the reverse of any entered number.
(e) Explain the list Comprehension with any suitable example.

QP23DP2_290 | 21-03-2023 13:31:19 | 117.55.242.132


SECTION C
3. Attempt any one part of the following: 5x1 = 5

(a) Illustrate Unpacking Sequences, Mutable Sequences, and List


comprehension with examples.
(b) Explain the lambda function. How it is helpful in the higher order function.
Explain map() function with a suitable example.

4. Attempt any one part of the following: 5x1 = 5

(a) Discuss the different types of argument-passing methods in python. Explain


the variable length argument with any suitable example.
(b) Write short notes on the following with a suitable example
I) Encapsulation II) Inheritance

5. Attempt any one part of the following: 5x1 = 5

(a) Demonstrate the file handling procedure in detail. Write a python code to
create a file with ‘P.txt’ name and write your name and father’s name in this

2
file and then read this file to print it.
90

13
(b) Demonstrate the ‘Sieve of Eratosthenes’ theorem and write the python
_2

function to print prime numbers between 1 to 100.

2.
P2

24
6. Attempt any one part of the following: 5x1 = 5

5.
3D

.5
P2

(a) Develop and write the python code of selection sort


17
41,65,43,91,12,14,62 elements. Also, explain its complexity.
to sort
Q

|1
(b) Explain Binary search with its python code and complexity.
9
:1

7. Attempt any one part of the following: 5x1 = 5


: 31
13

(a) Explain the importance of Exception handling in any object-oriented


programming language. Explain try exceptions and finally block with any
3

suitable example.
02

(b) Summarize the ‘Tower of Hanoi’ puzzle and write its recursive function to
-2

implement it.
03
1-
|2

QP23DP2_290 | 21-03-2023 13:31:19 | 117.55.242.132

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