0% found this document useful (0 votes)
5 views6 pages

IA1 Python-SchemeJLBNHL'

The document outlines the scheme of evaluation for the First Internal Assessment Test for the Introduction to Python Programming course at BMS Institute of Technology and Management. It includes details about the test date, duration, maximum marks, and the course outcomes related to Python programming. The document also lists various questions and coding tasks that students are expected to complete during the assessment.

Uploaded by

ktvinyas00
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)
5 views6 pages

IA1 Python-SchemeJLBNHL'

The document outlines the scheme of evaluation for the First Internal Assessment Test for the Introduction to Python Programming course at BMS Institute of Technology and Management. It includes details about the test date, duration, maximum marks, and the course outcomes related to Python programming. The document also lists various questions and coding tasks that students are expected to complete during the assessment.

Uploaded by

ktvinyas00
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/ 6

BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT

Avalahalli, Doddaballapura Main Road, Bengaluru - 560064


FIRST INTERNAL ASSESSMENT TEST, November-2024

SCHEME OF EVALUATION
Course Name Introduction to Python Programming Course Code 24PLC15B
27-11-2024
Branch & Semester Ist Semester CSE(Section 1-14) Date
[9:30AM to 11:00AM]
Name of the Course SR,CV,MKR,BS,CA,NP,AR,VP,MK,SS,MM,H
Max. Marks 40
Coordinator (s) KN,PG,GP

Qn. No. Questions Mark CO


s
1.a 1. Before you can use the functions in a module, you must import the module with
an import statement. In code, an import statement consists of the following: The
import keyword and the name of the module. Optionally, more module names,
as long as they are separated by commas.
Example:

2. from import statements


An alternative form of the import statement is composed of the from keyword,
followed by the module name, the import keyword, and a star; 4M CO1, K2
for example: from random import *.
● With this form of import statement, calls to functions in random will not need
the random. prefix.
● However, using the full name makes for more readable code, so it is better to
use the normal form of the import statement.
Example : from random import *

basic_salary = float(input("Enter the basic salary: ")) —---- 2mrks


1b hra = float(input("Enter the HRA: ")) 6M CO2,K3
da = float(input("Enter the DA: "))
loan_amount = float(input("Enter the loan amount: "))

# Calculate the gross salary —-----2mrks


gross_salary = basic_salary + hra + da

# Calculate the net salary


net_salary = gross_salary - loan_amount

# Print the net salary —----1mrk


print("Net salary:", net_salary)

Output: —---1mrk
Enter the basic salary: 18000
Enter the HRA: 900
Enter the DA: 2500
Enter the loan amount: 4000
Net salary: 17400.0

OR
2. a 1.It can be only one word. 4M CO1,K2
2. It can use only letters, numbers, and the underscore (_) character.
3. It can’t begin with a number.
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024

from datetime import date -------- 1mrks

Name = input("Enter the name of the person : ")

DOB = int(input("Enter his year of birth : ")) 6M CO2,K3

curYear = date.today().year -------- 2mrks

perAge = curYear - DOB

if perAge > =18: —------- 3mrks

print(Name, "aged", perAge, "is eligible to case vote.")

else:

print(Name, "aged", perAge, "is not eligible to cast vote.")

o/p —-- 1mrk

3a age = int(input("enter the age:")) —--- 1mrk 5M CO1,K2


status = input("enter your membership status (yes or no):") CO2,K3

if age<=12: —---- 4mrks


if status == "yes":
price = 100 - (100 * 0.5)
ticket_price = price - (price*0.1)
print("your ticket price isL:",ticket_price)
elif status == "no":
ticket_price = 100 - (100 * 0.5)
print("your ticket price isL:", ticket_price)
else:
print("invalid membership")

elif age>12:
if status == "yes":
ticket_price = 100 - (100 * 0.1)
print("your ticket price isL:",ticket_price)
elif status == "no":
ticket_price = 100
print("your ticket price isL:", ticket_price)
else:
print("invalid membership")
else:
print("invalid age")
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024

n = int(input("enter the limit of the series:"))

num1=0
num2=1

print("your series is:",num1,num2,end=" ")

for i in range(2,n):
num1,num2=num2,num2+num1
print(num2,end=" ")

OR

3b nterms = int(input("How many terms? ")) – —--------- 1mrk


# first two terms
n1, n2 = 0, 1
count = 0
# check if the number of terms is valid
if nterms <= 0: —----------- 1mrk
print("Please enter a positive integer")
elif nterms == 1:
print("Fibonacci sequence upto",nterms,":")
print(n1)
else:
print("Fibonacci sequence upto",nterms,":")
while count < nterms: —-----------3mrks
print(n1)
nth = n1 + n2
# update values
n1 = n2
n2 = nth
count += 1
OR
4a Break' in Python is a loop control statement. It is used to control the sequence of the 5M CO1,K2
loop. The break keyword is used to break out a for loop, or a while loop.
If the execution reaches a break statement, it immediately exits the while loop’s CO2,K3
clause. In code, a break statement simply contains the break keyword.

Continue statements:
o The continue keyword is used to end the current iteration in a for loop (or a while
loop) and continues to the next iteration. It is used inside the loop.
o When the program execution reaches a continue statement, the program execution
immediately jumps back to the start of the loop and reevaluates the loop’s condition.

4b

Explanation—> 3marks + Example —--> 2marks


BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024

sum=0
while True: —-------- 4marks + 1mrk(o/p)
n=int(input("enter the value:"))
if n>=0:
sum+=n
elif n<0:
break
else:
print("invalid input")

print("your sum is:",sum)


5M

5.a i)n= 10 4*1 CO2,K3


n value after check 2 M=4
M
ii)n= 2
n value after check 2

iii) n= 10
n value after check 10
iv) Error : name n is parameter and global

5.b def fact(n):


if n==0 or n==1:
return 1
return n*fact(n-1)
try:
n=int(input("enter the total number of items n"))
r=int(input("enter the number of items need to be selected r"))
if n>=r: CO2,K3
result=fact(n)/(fact(n-r)*fact(r))
print("total number of ways the item can be selected=",result) 6M
else:
print(" r should be less than or equal to n")
except Exception as e:
print(e)

OR
6.a print("cats","dogs","mice",end=" ") 2M CO2,K3
print("cats","dogs","mice",sep=",") +
return statement definition and one example 2M
=4M

6.b try:
a=int(input("enter the value of a"))
b=int(input("enter the value of b"))
result = a/b 6M CO2,K3
except ValueError as e:
print(e)
except ZeroDivisionError as e:
print("An exception occurred:", e)
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024

print("Exception type:", type(e))


else:
print(result)

7. regNum = 0 10 M CO3,K4
nameList = []
usnList = [] Main
usn='' :3
def addStudents():
if(len(usnList)<3): addS
name = input("Enter name :") tuden
nameList.append(name) ts:2
global regNum
regNum = regNum + 1 view
l = len(str(regNum)) Stud
if(l == 1): ents :
2
usn = "1BY24CS"+"000"+str(regNum)
elif(l == 2): Find
usn = "1BY24CS" + "00" + str(regNum) Num
elif (l == 3): ber
usn = "1BY24CS" + "0" + str(regNum) of
else: stude
usn = "1BY24CS" + "0" + str(regNum) nts 1
usnList.append(usn)
else:
print("Class is full.") displ
def viewStudentsDetails(): ayNa
print("Name USN") me :
for i in range(len(usnList)): 2
print(nameList[i]," ",usnList[i])
def findNumberOfStudents():
print("Number of students : ",len(usnList))
def displayName():
usn = input("Enter USN :")
print("Name of the student for usn as :",usn," is
",nameList[usnList.index(usn)])
def main():
while(True):
print("\nEnter 'a' to append,"
"'v' to view, "
"'f' to find class strength"
"'d' to display the name"
"'e' to exit the program")
choice = input()
if choice == 'a':
addStudents()
elif choice == 'v':
viewStudentsDetails()
elif choice == 'f':
findNumberOfStudents()
BMS INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Avalahalli, Doddaballapura Main Road, Bengaluru - 560064
FIRST INTERNAL ASSESSMENT TEST, November-2024

elif choice == 'd':


displayName()
elif choice == 'e':
break
main()
OR
8.a numList=[] CO3,K4
print("Enter a list of numbers : ") Input
for i in input().split(): :2
numList.append(int(i)) Max:
maxNum = max(numList) 1
secMaxNum = -1 Sec
for item in numList: Max:
if(item > secMaxNum and item < maxNum): 2
secMaxNum = item Outp
print(secMaxNum) ut :1

b. Statement X: 4 times
Statement Y: 1 times X
2 printi
list = [2, 1] ng :
33 1
list = [2, 1] Y
135 Printi
list = [2, 1, 1, 3] ng :1
28 List
list = [2, 1, 1, 3, 2, 2] printi
10 ng :
Sum = 14 1
Sum
:1

Course Outcomes (COs)


CO1: Understand syntax and semantics of python programming
CO2: Apply knowledge of python programming for different applications.
CO3: Develop python programs to realize various computational applications
CO4: Demonstrate the conduction of experiments for the given requirement using python
CO5: Take part in self-study individually, through an online course related to python programming and complete the course successfully.

Bloom’s Category
Remembering (K1) Understanding (K2) Applying (K3) Analyzing (K4) Evaluating (K5) Creating (K6)

Signatures of the Question Paper Scrutiny Committee

Course Coordinator(s) Module Coordinator(s) Program Coordinator Head of the Department

You might also like