Thanks to visit codestin.com
Credit goes to www.scribd.com

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

SC Computer 1 Final Finished

The document contains homework assignments for Computer Science students at Army Burn Hall College, including multiple choice questions, short answer questions, and long answer questions. It covers fundamental concepts in Python programming such as data types, iteration, subroutines, validation, and verification. Additionally, it provides examples and explanations of programming constructs like arrays and loops.

Uploaded by

ienvy1024
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 views5 pages

SC Computer 1 Final Finished

The document contains homework assignments for Computer Science students at Army Burn Hall College, including multiple choice questions, short answer questions, and long answer questions. It covers fundamental concepts in Python programming such as data types, iteration, subroutines, validation, and verification. Additionally, it provides examples and explanations of programming constructs like arrays and loops.

Uploaded by

ienvy1024
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/ 5

Army Burn Hall College for Boys

Summer vacations Home work


Subject : Computer Science Class SC

Part A – Multiple Choice Questions (MCQs)

Choose the correct option.

1. In Python, int is a data type for:


a) Text b) Whole numbers c) Colors d) Files

2. In Python, float stores:


a) Letters only b) Decimal numbers c) Pictures d) Dates

3. Which is an arithmetic operator?


a) PRINT b) + c) INPUT d) FOR

4. In iteration, the main idea is to:


a) Keep repeating steps b) Test memory size
c) Turn off the PC d) Draw shapes

5. Which Python operator calculates remainder?


a) // b) % c) ** d) ==

6. The statement “total = total + number” is an example of:


a) Selection b) Totalling c) Comparison d) String operation

7. Which best defines a subroutine?


a) A large program b) A small piece of code with a specific task
c) A hardware device d) A software bug

8. An array index usually starts at:


a) 5 b) -1 c) 0 d) 100

9. An example of verification technique is:


a) Range check b) Presence check c) Double entry d) Length check

10. A presence check is a type of:


a) Verification b) Data type c) Bug d) Database
11. A range check ensures:
a) Data is typed twice b) Data falls within limits
c) Data has correct spelling d) None of these

12. Python uses elif for:


a) Loops b) Selections c) Comments d) Arrays

13. In pseudocode, the keyword for a loop is often:


a) STOP b) DO c) SKIP d) TYPE

14. A linear search is:


a) Fast for large lists b) Not used in algorithms
c) Checking items one by one d) Only for numbers

15. A trace table is helpful for:


a) Making music b) Checking variable values
c) Designing graphics d) Changing colors

16. Data types in Python include all except:


a) int b) str c) dict d) add

17. Which operator raises a number to a power in Python?


a) * b) / c) ** d) %

18. A counting program:


a) Draws pictures c) Counts how often something happens
b) Stores only text d) Changes backdrop

19. Subroutines are useful because they:


a) Confuse the programmer b) Make code clearer and reusable
c) Increase file size only d) Add bugs

20. An array can store:


a) One number only b) Many values under one name
c) Only sounds d) Only text
Part B – Short Answer Questions

1. List three data types in Python.


Three data types in Python:
int (whole numbers)
float (decimal numbers)
str (text)

2. What is meant by iteration in programming?


Iteration means repeating a set of steps (e.g., using loops like for or while) until a condition is met.

3. Why are subroutines used in programs?


Subroutines (functions) are used to break code into reusable, manageable parts, improving clarity and
reducing redundancy.

4. Explain what totalling means in a program.


Totalling means accumulating a sum (e.g., total = total + number).

5. What is the purpose of using arrays in Python?


Arrays (lists in Python) store multiple values under one name for efficient data organization and access.
Part C – Long Answer Questions

1. Discuss the different types of validation and verification with examples of how they might
appear in pseudocode.

Validation vs. Verification:


Validation checks if input is sensible (e.g., range check: IF age < 0 OR age > 120 THEN ERROR).
Verification checks if data matches expectations (e.g., presence check: IF username == "" THEN
ERROR).

2. Explain with examples how selection, iteration, and sequence work together in a Python
program.

Sequence: Steps execute in order (e.g., a = 5; b = 10).


Selection: Conditional branching (e.g., IF score > 50 THEN PRINT "Pass").
Iteration: Repeating steps (e.g., FOR i IN range(5): PRINT i).
Example: A program counting valid scores:

total = 0
FOR score IN scores: # Iteration
IF score >= 0: # Selection
total = total + score # Sequence
3. Write a Python code snippet showing how to declare an array, store 5 values, and calculate the
sum. Explain your code.

# Declare an array (list) and store 5 values


numbers = [10, 20, 30, 40, 50]

# Calculate the sum


total = 0
for num in numbers:
total = total + num

print("Sum:", total) # Output: Sum: 150

Explanation:
numbers = [10, 20, 30, 40, 50] declares a list (Python’s array equivalent).
The for loop iterates over each value.
total = total + num accumulates the sum.
Finally, the sum is printed.

You might also like