Final Test
GG International School — Class VII IT Model Paper
This is the final test based on the actual model paper. Answer all questions.
Fill in the Blanks
1. The if statement is used to make __________ in a program.
2. The else block executes when the if condition is __________.
3. The elif keyword means "__________".
4. A for loop is mainly used to iterate over a __________.
5. The range() function generates a sequence of __________.
6. The len() function returns the __________ of an object.
7. The max() function returns the __________ value in a sequence.
8. The min() function returns the __________ value in a sequence.
9. The sum() function returns the __________ of elements in a sequence.
10. Standard library functions are __________ functions available in Python.
State True or False
1. Standard library functions are predefined functions in Python.
2. The len() function is a standard library function.
3. User-defined functions are part of the standard library.
4. Standard library functions must be written by the programmer every time.
Read the Code and Write the Output
x = 5
if x > 3:
print("A")
elif x > 4:
print("B")
else:
print("C")Output:
total = 0
for i in range(1, 5):
total += i
print(total)Output:
What does this code print? Type it in and run to verify:
for x in range(10, 20):
if x % 2 == 0:
print("hi")
print(x)x = 50
if x > 10:
if x > 25:
print("ok")
if x > 60:
print("good")
elif x > 40:
print("average")
else:
print("no output")Output:
s = "OpenAI"
print(len(s))Output:
word = "Python standard library"
print(word.upper())
print(word.lower())
print(len(word))What is the second line of output?
Read the Code and Find the Errors
Each snippet has an error. Fix the code so it runs correctly.
This program should check if a year is a leap year. Find and fix the errors:
This should print "Teenager" if age is between 10 and 18. Find the error:
This should print "x is ten" when x equals 10. Find the error:
Find and fix the error:
This should print "Pass" if marks are 40 or above. Find the error:
This should print numbers 0 through 4. Find and fix the error:
Perform Binary Addition
Solve: 11100 + 10011
Enter the result (6 bits, left to right):
Solve: 10101 + 10011
Enter the result (6 bits, left to right):
Solve: 11110 + 10111
Enter the result (6 bits, left to right):
Solve: 10110 + 11001
Enter the result (6 bits, left to right):
Write Python Programs
Write working code for each task. Click Run to test.
Write a program to check whether a number is even or odd. Test with num = 7.
Write a program to check whether a number is positive, negative, or zero. Test with num = -3.
Write a program to find the greater of two numbers using if-else. Test with a = 15, b = 22.
Write a program to check whether a person is eligible to vote (age >= 18).
Write a program to check if a year is a leap year. Test with year = 2024.
Write a program to calculate grade of a student based on marks: A (>=90), B (>=70), C (>=50), F (below 50).
Write a program to print numbers from 1 to 10 using a for loop.
Write a program to print even numbers between 1 and 20.
Write a program to find the sum of first N natural numbers. Test with n = 10 (expected: 55).
Write a program to print the multiplication table of a given number. Test with num = 7.
Write a program to print a star pattern (right triangle, 5 rows).
Ready to check your score?
Answer at least 75% of the questions to unlock scoring.