Cie1 QP and Scheme
Cie1 QP and Scheme
Q. 1. a What are functions? Explain Python functions with parameters and return 5 1 1, 2 2
statements.
OR
b Explain for loop and while loop with examples 5 1 1, 2 2
Q. 2. a Develop a Python program to calculate the circumference of a circle, and 5 1 1, 2 3
area of a circle.
OR
b Write a program that asks for a name and password and to validate the 5 1 1, 2 3
response (use while, break and continue statements).
Q. 3. a Explain negative indexing, index( ), sort( ), append( ), remove( ) with 5 2 1, 2 2
suitable examples.
OR
b Explain items( ), get() and setdefault() method in dictionary with 5 2 1, 2 2
examples.
Q. 4. a Write a program to create a dictionary of 10 key-value pairs and print only 5 2 1, 2 3
keys on the screen
OR
b Write a program to implement the magic -8 ball program using lists. 5 2 1, 2 3
Q. 5. a Develop a program to generate a Fibonacci sequence of length (N). Read 5 1 1, 2 3
N from the console.
OR
b Read N numbers from the console and create a list. Develop a program to 5 2 1, 2 3
print mean, variance and standard deviation with suitable messages.
* CO-Course Outcome * Program Outcomes *BCL-Bloom’s Cognitive Levels
*******
JAIN COLLEGE OF ENGINEERING, BELAGAVI
Department of Computer Science and Engineering
Academic year 2023-24
Continuous Internal Evaluation – 1 Class: II Semester ( A, B, C, D, J div)
Course Name: Introduction to Python Programming Course Code: BPLCK205B
Maximum Marks: 25 Date: 24-04-2024 Duration: 60 Minutes
Scheme of Evaluation
Marks CO’s PO’s BCL
import math
radius = float(input("Enter the radius of the circle: ")) 5 1 1, 2 3
area = math.pi * radius**2
circumference = 2 * math.pi * radius
print(f"Area of the circle: {area}")
print(f"Circumference of the circle: {circumference}")
OR
b Write a program that asks for a name and password and to validate the
response (use while, break and continue statements).
while True:
print('Who are you?')
name = input()
if name != 'Joe': 5 1 1, 2 3
continue
print('Hello, Joe. What is the password?')
password = input()
if password == 'swordfish':
break
print('Access granted.')
Q. 3. a Explain negative indexing, index( ), sort( ), append( ), remove( ) with
suitable examples.
2 1, 2 2
1
Explanation of negative indexing, index( ), sort( ), append( ), remove( each
) with suitable examples
OR
b Explain items( ), get() and setdefault() method in dictionary with
examples.
Explanation of 2 1, 2 2
items( ), 1
get() 2
setdefault() 2
Q. 4. a Write a program to create a dictionary of 10 key-value pairs and print
only keys on the screen
d={}
for i in range(10):
k=input('Enter the key:')
if d.get(k,0)==0: 5 2 1, 2 3
v=input('Enter the value')
d[k]=v
else:
print('This key already exists in the Dictionary
with the value',d.get(k))
for k, v in d.items():
print(k)
OR
b Write a program to implement the magic -8 ball program using lists.
import random
messages = ['It is certain', 'It is decidedly so', 'Yes 5 2 1, 2 3
definitely', 'Reply hazy try again', 'Ask again later',
'Concentrate and ask again', 'My reply is no', 'Outlook
not so good', 'Very doubtful']
print(messages[random.randint(0, len(messages) - 1)])
Q. 5. a Develop a program to generate a Fibonacci sequence of length (N).
Read N from the console.
import math
def mean(arr,n):
sum = 0
for i in range(0 ,n):
sum += arr[i]
mean = sum /n 5 2 1, 2 3
return mean
# Driver Code
n=int(input("Enter the length of the array: "))
arr=[]
for i in range(n):
arr.append(int(input("Enter the number: ")))
*******