Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Programming Using Python

GE-1, Sem-1, 2022-23

Assignment-1

Total Marks=20
Instructions:
 Attempt all questions honestly.
 All questions carry equal marks.
 Last Date of submission: 20th January

Q1. Write algorithm for the following:


a. To compute whether a number is a perfect square.
b. To compute greatest common divisor of two numbers.

Q2.a) Rewrite the following program segment using for loop


total=0
count=1
while count <5:
total+=count
count+=1
print(total)
b.) Identify the syntactical errors in the following code and rewrite the code after
removing them.
Def add:
a = b= 7
result = a + b
Q3. Consider the following function
def nMultiple(a=0, num=1):
return a*num
What will be the output of the following
a) nMultiple(5)
b) nMultiple(5,6)
c) nMultiple(num=7)
d) nMultiple(num=6, a=5)
e) nMultiple(5, num=6)
Q4. a) Draw a flowchart to find the largest of three numbers.
b) Draw a flowchart to check given year is a leap year or not.
Q5. Write a function to find the sum of first n terms of the following series:

You might also like