PROGRAMMING 511 – Semester 1 Mock Test
Section A: Theory (Short Answer Questions)
Q1. Machine vs High-Level Languages (5 marks)
• Define machine language and high-level programming languages.
• Mention two advantages and disadvantages of each.
Q2. Binary Numbers (5 marks)
• Convert the decimal number 45 into binary.
• Convert the binary number 101101 to decimal.
• Explain the importance of binary in computing.
Q3. Flowchart in Software Development (5 marks)
• Define what a flowchart is.
• Briefly explain its importance in program design.
• Draw a simple flowchart that shows a user inputting a number and printing if it’s
even or odd.
Q4. Data Types & Built-in Functions (5 marks)
• List any four basic Python data types and give an example for each.
• Define a built-in function and name three commonly used built-in functions in
Python.
Section B: Practical (Coding + Output Questions)
Q5. Prompt & Data Type (5 marks)
Write a Python script that:
• Asks the user to enter their age.
• Stores the input using the correct data type.
• Prints a message: "You are eligible to vote" if age is 18 or more, otherwise "You
are not eligible".
Q6. IF…ELIF Statement (10 marks)
Write a Python program that:
• Takes a numeric test score input from the user.
• Uses if, elif, and else to print the grade:
o 80–100: Distinction
o 60–79: Merit
o 50–59: Pass
o 0–49: Fail
o Invalid score: "Score must be between 0 and 100"
Q7. Counter-Controlled Loop (10 marks)
Write a while loop that:
• Prints numbers from 1 to 10.
• Adds each number to a running total.
• Finally, prints the sum of numbers from 1 to 10.
Bonus Question (Optional - 5 marks)
Explain the difference between a for loop and a while loop.
Give a small example of when you would use each.