CEGP013091: Programming and Problem Solving (2019 Pattern) (Semester - I) (110005)
CEGP013091: Programming and Problem Solving (2019 Pattern) (Semester - I) (110005)
8
23
P-9073 [Total No. Of Pages : 3
ic-
tat
[6178] - 8
4s
F.E.
5:3
02 91
Programming and Problem Solving
3:3
0
41
(2019 Pattern) (Semester - I) (110005)
0/0 13
Time :2½ Hours] [Max. Marks : 70
0
1/2
.23 GP
8
C
23
4) Assume suitable data wherever necessary.
ic-
16
tat
Q1) a) Define a function with suitable example? Explain need for a function. [6]
8.2
4s
b) Differentiate between local and global variables. [6]
.24
5:3
91
c) Write a program using function to find square of a number. [5]
49
3:3
30
OR
41
Q2) a) Explain the following types of function arguments with examples: [6]
01
02
8
function. [5]
23
.23
ic-
Q3) a) Explain string indexing and slicing with suitable example. [6]
16
tat
b) Explain the following with suitable example. [6]
8.2
4s
5:3
c) What is the output of the following statement for the given string?
91
49
3:3
P.T.O.
.24
49
8
OR
23
ic-
Q4) a) Explain string format method with suitable example. [6]
tat
4s
b) Explain following string methods with example. [6]
5:3
i) title()
02 91
3:3
0
ii) capitalize()
41
0/0 13
iii) lower()
0
1/2
.23 GP
8
C
23
Q5) a) What is programming paradigm? Explain the following Programming
ic-
Paradigms in detail [6]
16
tat
8.2
4s
i) Monolithic Programming
.24
5:3
91
ii) Procedural Programming
49
3:3
30
i) Object variable
1/2
GP
8
c) Write a python program to create a class Employee with the attributes
23
.23
tat
OR
8.2
4s
.24
3:3
i) Class
30
41
ii) Inheritance
01
02
1/2
iii) Polymorphism
GP
0/0
c) Write a program to create class Car with two attributes name and cost.
.23
[6178]-8 2
49
Q7) a) What is a file? Explain relative and absolute path of a file. [6]
8
23
ic-
b) Explain the following file handling methods. [6]
tat
4s
i) write()
5:3
02 91
ii) tell()
3:3
0
41
iii) seek()
0/0 13
0
c) Explain the following file access modes
1/2 [6]
.23 GP
8
C
23
OR
ic-
16
tat
8.2
4s
.24
5:3
b) Explain text and binary files with example. [6]
91
49
3:3
30
41
8
23
.23
ic-
16
tat
8.2
4s
.24
5:3
91
49
3:3
30
41
01
02
1/2
GP
0/0
CE
81
.23
16
8.2
.24
[6178]-8 3
49
Total No. of Questions : 8] SEAT No. :
8
23
PB3593 [Total No. of Pages : 3
ic-
[6260]-8
tat
F.E.
0s
PROGRAMMING AND PROBLEM SOLVING
3:5
(2019 Pattern) (Credit System) (Semester - I/II) (110005)
02 91
9:3
Time : 2½ Hours] [Max. Marks : 70
0
40
0/0 13
Instructions to the candidates:
1) Solve Q.1 or Q.2, Q.3 or Q.4, Q.5 or Q.6, Q.7 or Q.8.
0
2) Neat diagrams must be drawn weherver necessary.
5/2
.23 GP
8
C
23
b) Explain how we can pass command line arguments in python with a
ic-
suitable example. [6]
16
tat
8.2
0s
using a function. [5]
.24
3:5
91
49
OR
9:3
30
40
Q2) a) Write syntax of function definition and function call. Give a suitable
example for the same. [6]
01
02
5/2
8
23
.23
tat
8.2
0s
.24
3:5
9:3
i) concatenation
30
40
ii) appending
01
02
OR
8.2
.24
P.T.O.
49
[6260]-8 1
Q4) a) Explain string module in python. [6]
8
23
b) Explain following string methods with example. [6]
ic-
i) split()
tat
0s
ii) zfill()
3:5
iii) replace()
02 91
9:3
c) Write a program to reverse a string without using slicing operator. [5]
0
40
0/0 13
0
Q5) a) Explain the following programming Paradigms in detail.
5/2 [6]
.23 GP
i) Procedural
E
ii) Structured
83
8
C
23
iii) Object Oriented
ic-
16
tat
8.2
0s
c) Write a program to create a class ‘Book’ with members, title, author,
.24
3:5
publisher, and ISBN number. The functions of the class should read and
91
49
OR
01
02
8
iii) Inheritance
23
.23
tat
c) Write a program to calculate area of square and rectangle using a class.[6]
8.2
0s
.24
3:5
91
49
i) seek()
5/2
GP
ii) writelines()
0/0
iii) readline()
CE
83
c) Write a program that reads text from a file and writes in into another file
.23
but in the reverse order. (Hint: Make the first line in the original file as the
16
OR
.24
49
[6260]-8 2
Q8) a) Explain the following method with suitable example [6]
8
23
i) getcwd()
ic-
tat
ii) rmtree()
0s
3:5
iii) makedirs()
02 91
9:3
0
b) What is a file path? Explain absolute path and relative path. [6]
40
0/0 13
c) Explain the following dictionary methods. [6]
0
5/2
.23 GP
i) fromkeys()
E
83
8
C
23
ii) setdefault()
ic-
16
iii) update()
tat
8.2
0s
.24
3:5
91
49
9:3
30
40
01
02
5/2
GP
0/0
CE
83
8
23
.23
ic-
16
tat
8.2
0s
.24
3:5
91
49
9:3
30
40
01
02
5/2
GP
0/0
CE
83
.23
16
8.2
.24
49
[6260]-8 3
Total No. of Questions : 9] SEAT No. :
8
23
P6995 [Total No. of Pages : 4
ic-
[5868]-107
tat
6s
F.E. (Semester - I & II)
0:1
110005 : PROGRAMMING AND PROBLEM SOLVING
02 91
8:4
(2019 Pattern) (Common)
0
20
8/0 13
Time : 2½ Hours] [Max. Marks : 70
0
8/2
Instructions to the candidates:
.23 GP
8
C
23
3) Neat diagrams must be wherever necessary.
ic-
4) Assume suitable data wherever necessary.
16
tat
8.2
6s
.24
0:1
Q1) i) Which one of the following is the correct way of calling a function?
91
49
8:4
a) f_name() b) call f_name()
30
20
a) .pt b) .pyt
CE
80
8
23
c) .py d) .cpp
.23
ic-
16
6s
a) ord() b) chr()
.24
0:1
91
c) input() d) output()
49
8:4
30
20
iv) Which is the default access mode in the open () function for files in
01
Python?
02
8/2
GP
a) w b) r
8/0
c) a d) w+
CE
80
a) toupper() b) upper()
8.2
c) uppercase() d) touppercase()
.24
49
P.T.O.
vi) Which method is automatically executed when an object of a class is
8
created?
23
ic-
a) _init_() b) _call_()
tat
c) _repr_() d) _del_()
6s
0:1
vii) You can use Python for
02 91
8:4
a) Application programming b) Web programming
0
20
c) 8/0 13
Artificial intelligence d) All of these
0
8/2
viii)Which of the following keyword is used in user defined function header
.23 GP
in Python?
E
80
8
a) define b) def
C
23
ic-
c) function d) fun
16
tat
ix) What does open() function return?
8.2
6s
.24
a) function b) variable
0:1
91
49
8:4
c) file object d) none of these
30
20
a) close(file) b) close(“file”)
8/2
GP
8/0
c) file.closed() d) file.close()
CE
80
8
23
.23
Q2) a) Define a function. Explain function definition and function call with
ic-
16
tat
suitable example. [6]
8.2
6s
0:1
91
49
[4]
30
20
OR
01
02
i) Required arguments
8/0
CE
example. [5]
8.2
[5868]-107 2
Q4) a) Explain the following string operations with suitable example. [6]
8
23
i) Concatenation
ic-
tat
ii) Appending
6s
iii) String repetition
0:1
02 91
8:4
b) Explain indexing and slicing operation on string with suitable example.
0
20
8/0 13 [5]
8
C
23
OR
ic-
16
tat
Q5) a) Explain following string methods with example. [6]
8.2
6s
.24
0:1
i) strip()
91
49
8:4
ii) index()
30
20
iii) isdigit()
01
02
8/2
GP
[4]
80
8
23
.23
ic-
16
tat
Q6) a) Explain any three programming paradigms. [6]
8.2
6s
0:1
91
[5]
49
8:4
30
20
OR
8/2
GP
i) Data encapsulation
.23
iii) Polymorphism
.24
49
[5868]-107 3
b) Explain class variables and object variable with suitable example. [5]
8
23
c) Write a program to create a class ‘Employee’ with two attributes.
ic-
Display the details of two employees. [4]
tat
6s
0:1
02 91
Q8) a) What is a file? Explain different access modes for opening files. [6]
8:4
0
20
b) What is a dictionary? How to create, access and modify dictionary
elements.
8/0 13 [5]
0
8/2
.23 GP
OR
E
80
8
C
23
Q9) a) Explain any three methods for reading and writing files. [6]
ic-
16
tat
b) Explain different directory methods with suitable examples. [5]
8.2
6s
.24
0:1
c) Write a program to read first 10 characters from the file and display it.
91
49
[4]
8:4
30
20
01
02
8/2
GP
8/0
CE
80
8
23
.23
ic-
16
tat
8.2
6s
.24
0:1
91
49
8:4
30
20
01
02
8/2
GP
8/0
CE
80
.23
16
8.2
.24
49
[5868]-107 4
Total No. of Questions : 8] SEAT No. :
8
23
P-3664 [Total No. of Pages : 3
ic-
tat
[6001]-4008
2s
F.E. (Semester - II)
6:5
02 91
0:4
PROGRAMMING AND PROBLEM SOLVING
0
31
(2019 Pattern) (110005)
2/0 13
0
Time : 2½ Hours] [Max. Marks : 70
8/2
.23 GP
8
2) Solve Q.1 or Q.2, Q.3 or Q.4, Q.5 or Q.6 and Q.7 or Q.8.
C
23
3) Neat diagrams must be wherever necessary.
ic-
16
tat
8.2
2s
.24
Q1) a) Explain in-built and user defined functions with syntax and suitable
6:5
91
example. [6]
49
0:4
30
i) local variable
01
02
8/2
[5]
80
8
23
OR
.23
Q2) a) Explain the following types of function arguments with examples: [6] ic-
16
tat
8.2
i) positional arguments
2s
.24
6:5
0:4
P.T.O.
.24
49
c) What is the output of the following statement for the given string? [5]
8
23
S = “Programming and Problem Solving”
ic-
i) print(S[:11])
tat
2s
ii) print(S[::-1])
6:5
iii) print("And" not in S)
02 91
0:4
iv) print(S[4])
0
31
v) 2/0 13
print (S[0:10])
0
8/2
OR
.23 GP
8
b) Explain following string methods with example. [6]
C
23
ic-
i) title()
16
tat
ii) startswith()
8.2
2s
iii) zfill()
.24
6:5
91
49
i) Monolithic Programming
CE
80
8
ii) Structured Programming
23
.23
ic-
iii) Object Oriented Programming
16
tat
b) Explain the following concepts with example. [6]
8.2
2s
.24
i) public members
6:5
91
49
0:4
c) Write a python program to create a class Student with the attributes Name,
01
02
OR
2/0
b) Explain class method and class variable with suitable example. [6]
.23
[6001]-4008 2
49
Q7) a) What is a file? Explain relative and absolute path of a file. [6]
8
23
b) Explain the following file handling methods. [6]
ic-
i) write()
tat
2s
ii) writelines()
6:5
02 91
ii) close()
0:4
0
c) Explain file access modes in brief. [6]
31
2/0 13 OR
0
8/2
Q8) a) Explain different directory methods with example. [6]
.23 GP
8
C
23
ic-
i) update()
16
tat
8.2
ii) keys()
2s
.24
6:5
iii) pop()
91
49
0:4
30
31
01
02
8/2
GP
2/0
CE
80
8
23
.23
ic-
16
tat
8.2
2s
.24
6:5
91
49
0:4
30
31
01
02
8/2
GP
2/0
CE
80
.23
16
8.2
.24
[6001]-4008 3
49
Total No. of Questions : 8] SEAT No. :
8
23
P4937 [Total No. of Pages : 3
ic-
[5667]-1008
tat
9s
F.E. (Semester - I)
2:5
PROGRAMMING & PROBLEM SOLVING
02 91
9:4
(2019 Pattern)
0
00
2/0 13
Time : 3 Hours] [Max. Marks : 70
0
1/2
.23 GP
8
C
23
3) Assume suitable data wherever necessary.
ic-
16
tat
Q1) a) What is function? Explain code reuse. Explain with example Docstring.
8.2
9s
[6]
.24
2:5
91
b) Explain Lambda function with example. [6]
49
9:4
30
OR
GP
2/0
Q2) a) Differentiate between Local & Global variable. Write a python program
CE
80
8
to demonstrate difference between local and global variable. [6]
23
.23
ic-
b) Explain keyword arguments in python. Write a python program to
16
tat
demonstrate keyword arguments. [6]
8.2
9s
2:5
even. [6]
91
49
9:4
30
00
01
i) Rindex
2/0
ii) Z fill
CE
80
iii) Split
.23
16
character. [6]
.24
P.T.O.
49
c) What will be the output of following statement S = “Welcome to Python”.
8
23
[5]
ic-
i) Print (s[1:9])
tat
ii) Print (s[ :6])
9s
iii) Print (s[4: ])
2:5
02 91
iv) Print (s[1: –1])
9:4
0
v) Print (“Come” not in str)
00
2/0 13 OR
0
1/2
.23 GP
8
C
23
ii) Enumerate
ic-
16
iii) 1 strip
tat
8.2
9s
b) Write python, program to find whether a given character is present in a
.24
2:5
string or not. In case it is present print the index at which it is present. Do
91
49
8
any one. [6]
23
.23
tat
8.2
c) Write a python program that uses class to store exam number and marks
9s
of four subjects. Use list to store the marks of four subjects. [6]
.24
2:5
91
49
9:4
OR
30
00
ii) Polymorphism
2/0
CE
80
b) With the help of an example explain the significance of the inif ( ) method.
.23
[6]
16
c) Write a python program to create class car with two attributes name &
8.2
[5667]-1008 2
49
Q7) a) Write a python program that reads data from one file and write into
8
23
another file and line by line. [6]
ic-
b) What is directory? List any four directory methods and explain any two
tat
of them. [6]
9s
2:5
c) Why do we need files? Explain relative and absolute path in files. [5]
02 91
9:4
OR
0
00
Q8) a) 2/0 13
Write a python program that counts the number of tabs and new line
characters in a file. [6]
0
1/2
.23 GP
8
C
23
c) Differentiate between text and binary files. Explain any 4 access modes
ic-
used in python. [5]
16
tat
8.2
9s
.24
2:5
91
49
9:4
30
00
01
02
1/2
GP
2/0
CE
80
8
23
.23
ic-
16
tat
8.2
9s
.24
2:5
91
49
9:4
30
00
01
02
1/2
GP
2/0
CE
80
.23
16
8.2
.24
[5667]-1008 3
49