0% found this document useful (0 votes)
2 views2 pages

Python Basics Test

The document outlines a Python Basics Test consisting of theoretical and practical questions, totaling 50 marks with a time limit of 60 minutes. Section A includes 10 theoretical questions covering topics like errors, data types, operators, and control statements, while Section B consists of 7 practical coding tasks that require writing Python programs for various scenarios. The test assesses both understanding of Python concepts and practical coding skills.

Uploaded by

moeedbinmaqsood
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)
2 views2 pages

Python Basics Test

The document outlines a Python Basics Test consisting of theoretical and practical questions, totaling 50 marks with a time limit of 60 minutes. Section A includes 10 theoretical questions covering topics like errors, data types, operators, and control statements, while Section B consists of 7 practical coding tasks that require writing Python programs for various scenarios. The test assesses both understanding of Python concepts and practical coding skills.

Uploaded by

moeedbinmaqsood
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

■ Python Basics Test

Total Marks: 50 Time: 60 Minutes

Section A – Theoretical Questions (25 Marks)


1. What is the difference between a syntax error and a logical error? (2 marks)
2. Define a variable in Python. Give one example. (2 marks)
3. List any four data types in Python and give one example for each. (4 marks)
4. What is the purpose of the input() function in Python? (2 marks)
5. Explain the difference between ‘=’ and ‘==’ operators. (2 marks)
6. Write any two comparison operators and explain their use with an example. (3 marks)
7. What is the difference between if, elif, and else statements? (3 marks)
8. What is the purpose of the break and continue statements in loops? Give examples. (3 marks)
9. Mention any two differences between List and Tuple. (2 marks)
10. Write the output of the following code: (2 marks)

x = 5
y = 10
if x < y:
print('Smaller')
else:
print('Greater')

Section B – Practical Coding Questions (25 Marks)


1. Variables and Input (3 marks)
Write a Python program that takes the user’s name and age as input and prints: 'Hello [name], you
are [age] years old!'
2. Operators (3 marks)
Write a program that takes two numbers and prints their sum, difference, product, and remainder.
3. Conditions (5 marks)
Write a program that asks for a student’s marks and prints:
• Grade A if marks ≥ 80
• Grade B if marks between 60 and 79
• Grade C if marks between 40 and 59
• Fail otherwise
4. Loop (4 marks)
Write a program using a for loop that prints numbers from 1 to 10 but skips number 5.
5. Break & Continue (3 marks)
Write a while loop that prints numbers from 1 to 10, but stops the loop when it reaches 7.
6. List (4 marks)
Create a list of 5 numbers.
• Print the list
• Add one more number
• Remove one number
• Print the updated list
7. Tuple (3 marks)
Create a tuple of 3 colors and print the first and last color.

You might also like