0% found this document useful (0 votes)
61 views3 pages

Gujarat Technological University

Python

Uploaded by

rakshgojariya
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)
61 views3 pages

Gujarat Technological University

Python

Uploaded by

rakshgojariya
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/ 3

Seat No.: ________ Enrolment No.

______________

GUJARAT TECHNOLOGICAL UNIVERSITY


Diploma Engineering – SEMESTER – 3 (NEW) – EXAMINATION – Winter-2022

Subject Code: 4330701 Date: 23-02-2023


Subject Name: Scripting Language -Python
Time: 02:30 PM TO 05:00 PM Total Marks: 70
Instructions:
1. Attempt all questions.
2. Make Suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Use of programmable & Communication aids are strictly prohibited.
5. Use of non-programmable scientific calculator is permitted.
6. English version is authentic.

Marks
Q.1 (a) Explain if-elif-else control structure in Python. 03
પાયથોનમાાં if-elif-else નનયાંત્રણ માળખાં સમજાવો.
(b) Explain type casting in Python. 04
પાયથોનમાાં ટાઇપ કાન્ટાં ગ સમજાવો.
(c) Explain features of Python programming language. 07
પાયથોન પ્રોગ્રાનમાંગ ભાષાની લાક્ષનણકતાઓ સમજાવો.
OR
(c) Write a program to calculate simple and compound interest. 07
𝑃∗𝑅∗𝑇
Simple Interest= 100 and
𝑅 𝑁∗𝑇
Compound interest=𝑃 [(1 + 100∗𝑁) − 1]

Where P=Principal amount , R= rate of interest, T=Total duration,


N=number of times interest got compounded annually.
સાદ વ્યાજ અને ચક્રવૃનિ વ્યાજ ગણવા માટે નો પ્રોગ્રામ લખો.
𝑃∗𝑅∗𝑇
સાદ વ્યાજ= 100 અને
𝑅 𝑁∗𝑇
ચક્રવૃનિ વ્યાજ =𝑃 [(1 + 100∗𝑁) − 1]

Where P=મદ્દલ રકમ , R= વ્યાજદર, T=કલ સમયગાળો , N=વષષ મા કે ટલી


વાર ચક્રવૃનિ વ્યાજ ગણવામા આવ્ય.
Q.2 (a) Explain for loop with example. 03
ઉદાહરણ સાથે for લૂપ સમજાવો.
(b) Write a program to find the sum of following series: 04
1 1 1
1 + + + +. . . . . . . 𝑁 𝑡𝑒𝑟𝑚𝑠
3 5 7

નીચેની શ્રેણીનો સરવાળો શોધવા માટે પ્રોગ્રામ લખો:


1 1 1
1 + + + + ⋯ … . 𝑁 પદ સધી
3 5 7
(c) Write a program that find whether a given year is a leap year or not. 07
આપેલ વષષ લીપ વષષ છે કે નહીાં તે શોધવા માટે નો પ્રોગ્રામ લખો.
OR

1
Q.2 (a) List out different types of control statements in python and explain 03
any one.
પાયથોનમાાં નવનવધ પ્રકારના નનયાંત્રણ ્ટે ટમેન્ટની યાદી બનાવો અને
કોઈપણ એક સમજાવો.
(b) Write a program to print following pattern. 04
1
22
333
4444
55555
નીચે મજબની પેટનષ નપ્રાંટ કરવા માટે નો પ્રોગ્રામ લખો.
1
22
333
4444
55555
(c) Explain below string functions. 07
max, isalpha, islower, isspace, count, rfind and swapcase
નીચેના ્ટ્ ીાંગ ફાં ક્શન સમજાવો.
max, isalpha, islower, isspace, count, rfind and swapcase
Q.3 (a) Write a program to find the number of times an element occurs in the 03
list.
નલ્ટ મા કોઇ ઘટક કે ટલી વખત આવે છે તે શોધવા માટે નો પ્રોગ્રામ લખો.
(b) Differentiate between append() and extend() methods of list. 04
નલ્ટ ની append() અને extend() મેથડ વચ્ચેનો તફાવત લખો.
(c) Write an automated censor program that reads the text from a file and 07
creates a new file where all of the four-letter words have been replaced
by “****”.
્વયાંસાંચાનલત સેન્સર પ્રોગ્રામ લખો જે ફાઇલમાાંથી ટે ક્્ટ વાાંચે અને નવી
ફાઇલ બનાવે છે જ્ાાં ચાર-અક્ષરના બધા શબ્દો "****" દ્વારા બદલાય જાય.
OR
Q.3 (a) Write syntax of if-else and nested if-else. 03
if-else અને nested if-else ની નસાંટેક્ષ લખો.
(b) Explain basic tuple operations with example. 04
મૂળભૂત ટપલ ઓપરેશન્સ ઉદાહરણ સાથે સમજાવો.
(c) Write a program to randomly fill in 0s and 1s into a 4x4 2-dimension 07
list, print the list and find the rows and columns with the most
number of 1s.
એક એવો પ્રોગ્રામ લખો કે જે 4x4 નદ્વ-પનરમાણ નલ્ટમાાં રેન્ડમલી 0s અને 1s
ફીલ કરે, સૂનચ નપ્રાંટ કરે અને જે કોલમ અને રો મા સૌથી વધ 1 આવતા
હોઇ એવી રો અને કોલમ શોધી આપે.
Q.4 (a) Explain addition of an item and modification of existing item of 03
dictionary with example.
આઇટમનો ઉમેરો અને નડક્શનરીની હાલની આઇટમમાાં ફે રફાર ઉદાહરણ
સાથે સમજાવો.
(b) For the given set A={1,2,3,4,5} and B={10,2,3,4,50} match following 04
Statement with output.
Statement Output
A|B {1, 5}
A&B {1, 50, 5, 10}
A^B {1, 2, 3, 4, 5, 10, 50}
A-B {2, 3, 4}

2
આપેલ સેટ A={1,2,3,4,5} અને B={10,2,3,4,50} માટે નીચેના ્ટે ટમેન્ટ
સાથે આઉટપટ ના જોડકા જોડો.
્ટે ટમેન્ટ આઉટપટ
A|B {1, 5}
A&B {1, 50, 5, 10}
A^B {1, 2, 3, 4, 5, 10, 50}
A-B {2, 3, 4}
(c) Write a program to print Fibonacci sequence up to n numbers using 07
recursion.
નરકર્ષ નનો ઉપયોગ કરીને n નાંબર સધી નફબોનાકી નસક્વન્સ નપ્રન્ટ કરવા
માટે પ્રોગ્રામ લખો.
OR
Q.4 (a) List out functions of datetime module. 03
datetime મોડ્યલના ફાં ક્શન ની યાદી બનાવો.
(b) Write advantages of function in Python. 04
પાયથોનમાાં ફાં ક્શનના ફાયદા લખો.
(c) Explain the creation of user defined module and procedure to import 07
it in other program with example.
યર્ર નડફાઇન્ડ મોડ્યલની રચના અને તેને અન્ય પ્રોગ્રામમાાં ઇમ્પોટષ
કરવાની પ્રનક્રયા ઉદાહરણ સાથે સમજાવો.
Q.5 (a) Explain following functions. 03
(i) math.exp() (ii) math.floor() (iii) math.pow()
નીચેના ફાં ક્શન સમજાવો.
(i) math.exp() (ii) math.floor() (iii) math.pow()
(b) Write a program to plot sine wave using matplotlib. 04
matplotlib નો ઉપયોગ કરીને સાઈન વેવને પ્લોટ કરવા માટે એક પ્રોગ્રામ
લખો.
(c) List out various file accessing modes and explain each of them. 07
નવનવધ ફાઇલ એક્સેનસાંગ મોડ્સની યાદી બનાવો અને તેમાાંથી દરેકને
સમજાવો.
OR
Q.5 (a) List out functions for writing to file operation and explain each. 03
ફાઇલ ઑપરેશનમાાં લખવા માટે ના ફાં ક્શન ની સૂનચ બનાવો અને દરેકને
સમજાવો.
(b) Explain following string functions with example. 04
(i) endswith() (ii) find()
નીચેના ્ટ્ ીાંગ ફાં ક્શનો ઉદાહરણ સાથે સમજાવો.
(i) endswith() (ii) find()
(c) Write a program to read a date in the format DD/MM/YYYY and print 07
the same date in MM-DD-YYYY format.
DD/MM/YYYY ફોમેટમાાં તારીખ વાાંચવા માટે એક પ્રોગ્રામ લખો અને તે
જ તારીખ MM-DD-YYYY ફોમેટમાાં છાપો.

You might also like