Loading Python...
0 / 0 completed

Final Test

GG International School — Class VII IT Model Paper

This is the final test based on the actual model paper. Answer all questions.

Q1 (A)

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.

Q1 (B)

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.

Q2

Read the Code and Write the Output

Q2.1
x = 5
if x > 3:
    print("A")
elif x > 4:
    print("B")
else:
    print("C")

Output:

Q2.2
total = 0
for i in range(1, 5):
    total += i
print(total)

Output:

Q2.5

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)

    
  
Q2.6
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:

Q2.7
s = "OpenAI"
print(len(s))

Output:

Q2.8
word = "Python standard library"

print(word.upper())
print(word.lower())
print(len(word))

What is the second line of output?

Q3

Read the Code and Find the Errors

Each snippet has an error. Fix the code so it runs correctly.

Q3.1 — Fix the Leap Year Program

This program should check if a year is a leap year. Find and fix the errors:


    
  
Q3.3 — Fix the Age Check

This should print "Teenager" if age is between 10 and 18. Find the error:


    
  
Q3.6 — Fix the Comparison

This should print "x is ten" when x equals 10. Find the error:


    
  
Q3.8 — Fix the Greater/Smaller Check

Find and fix the error:


    
  
Q3.10 — Fix the Pass Check

This should print "Pass" if marks are 40 or above. Find the error:


    
  
Q3.14 — Fix the Loop

This should print numbers 0 through 4. Find and fix the error:


    
  
Q4 (A)

Perform Binary Addition

Q4a

Solve: 11100 + 10011

Enter the result (6 bits, left to right):

Q4b

Solve: 10101 + 10011

Enter the result (6 bits, left to right):

Q4c

Solve: 11110 + 10111

Enter the result (6 bits, left to right):

Q4d

Solve: 10110 + 11001

Enter the result (6 bits, left to right):

Q6

Write Python Programs

Write working code for each task. Click Run to test.

Q6.1

Write a program to check whether a number is even or odd. Test with num = 7.


    
  
Q6.2

Write a program to check whether a number is positive, negative, or zero. Test with num = -3.


    
  
Q6.3

Write a program to find the greater of two numbers using if-else. Test with a = 15, b = 22.


    
  
Q6.5

Write a program to check whether a person is eligible to vote (age >= 18).


    
  
Q6.6

Write a program to check if a year is a leap year. Test with year = 2024.


    
  
Q6.9

Write a program to calculate grade of a student based on marks: A (>=90), B (>=70), C (>=50), F (below 50).


    
  
Q6.11

Write a program to print numbers from 1 to 10 using a for loop.


    
  
Q6.12

Write a program to print even numbers between 1 and 20.


    
  
Q6.14

Write a program to find the sum of first N natural numbers. Test with n = 10 (expected: 55).


    
  
Q6.15

Write a program to print the multiplication table of a given number. Test with num = 7.


    
  
Q6.20

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.