**Question 1- Mark the following statements as True or False.**

**a.**The first device known to carry out calculations was the Pascaline.

**FALSE**

**b.**Modern-day computers can accept spoken-word instructions but cannot imitate human reasoning.

**FALSE**

**c.**In ASCII coding, every character is coded as a sequence of 8 bits.

**TRUE**

**d.**A compiler translates a high-level program into assembly language.

**TRUE**

**e.**The arithmetic operations are performed inside CPU, and if an error is found, it outputs the logical errors.

**FALSE**

**f.**A sequence of 0s and 1s is called a decimal code.

**FALSE**

**g.**A linker links and loads the object code from main memory into the CPU for execution.

**TRUE**

**h.**Development of a C++ program includes six steps.

**TRUE**

**i.**A program written in a high-level programming language is called a source program.

**TRUE**

**j.**ZB stands for zero byte.

**FALSE**

**k.**The first step in the problem-solving process is to analyze the problem.

**TRUE**

**l.**In object-oriented design, a program is a collection of interacting functions.

**FALSE**

**2. Name two input devices.**

**Ans:**Keyboard , Mouse

**3. Name two output devices.**

**Ans:**Monitor, LCD and Printer

**4. Why is secondary storage needed?**

**Ans:**

**5. What is the function of an operating system?**

**Ans:**

**6. What are the two types of programs?**

**Ans:****7. What are the differences between machine languages and high-level languages?**

**Ans:**

**8. What is a source program?**

**Ans:**

**9. Why do you need a compiler?**

**Ans:**

**10. What kind of errors are reported by a compiler?**

**Ans:****11. Why do you need to translate a program written in a high-level language into machine language?**

**Ans:**

**12. Why would you prefer to write a program in a high-level language rather than a machine language?**

**Ans:**

**13. What is linking?**

**Ans:**

**14. What are the advantages of problem analysis and algorithm design over directly writing a program in a high-level language?**

**Ans:****15. Design an algorithm to find the weighted average of four test scores. The four test scores and their respective weights are given in the following format:**

**testscore1 weight1**

**
**

...

For example, sample data is as follows:

75 0.20

95 0.35

85 0.15

65 0.30

**Ans:**

**16. Design an algorithm to convert the change given in quarters, dimes, nickels, and pennies into pennies.**

**Ans:**

**17. Given the radius, in inches, and price of a pizza, design an algorithm to find the price of the pizza per square inch.**

**Ans:**

**18. A salesperson leaves his home every Monday and returns every Friday. He travels by company car. Each day on the road, the salesperson records the amount of gasoline put in the car. Given the starting odometer reading (that is, the odometer reading before he leaves on Monday) and the ending odometer reading (the odometer reading after he returns home on Friday), design an algorithm to find the average miles per gallon. Sample data is as follows:**

**68723 71289 15.75 16.30 10.95 20.65 30.00**

**
**

**Ans:**

**19. To make a profit, the prices of the items sold in a furniture store are marked up by 60%. Design an algorithm to find the selling price of an item sold at the furniture store. What information do you need to find the selling price?**

**Ans:**

**20. Suppose a, b, and c denote the lengths of the sides of a triangle. Then the area of the triangle can be calculated using the formula: ﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃﬃ**

**sðs _ aÞðs _ bÞðs _ cÞ**

**
**

p

;

where s = (1/2)(a + b + c). Design an algorithm that uses
this formula to find the area of a triangle. What information do you need to
find the area?

**Ans:**

**21. Suppose that the cost of sending an international fax is calculated as follows:**

**Service charges**

**
**

$3.00; $.20 per page for the first 10 pages; and $0.10 for
each additional page. Design an algorithm that asks the user to enter the
number of pages to be faxed. The algorithm then uses the number of pages to be
faxed to calculate the amount due.

**Ans:**

**22. An ATM allows a customer to withdraw a maximum of $500 per day. If a customer withdraws more than**

**$300, the service charge is 4% of the amount**

**
**

over

$300. If the customer does not have sufficient money in the
account, the

ATM informs the customer about the insufficient fund and
gives the option to withdraw the money for a service charge of

$25.00. If there is no money in the account or if the
account balance is negative, the ATM does not allow the customer to withdraw
any money. If the amount to be withdrawn is greater than

$500, the ATM informs the customer about the maximum amount
that can be withdrawn. Write an algorithm that allows the customer to enter the
amount to be withdrawn. The algorithm then checks the total amount in the
account, dispenses the money to the customer, and debits the account by the amount
withdrawn and the service charges, if any.

**Ans:**

**23. You are given a list of students’ names and their test scores. Design an algorithm that does the following:**

**a. Calculates the average test scores.**

b. Determines and prints the names of all the students whose
test scores are below the average test score.

c. Determines the highest test score.

d. Prints the names of all the students whose test scores
are the same as the highest test score.

(You must divide this problem into sub problems as follows:
The first sub problem determines the average test score. The second sub problem
determines and prints the names of all the students whose test scores are below
the average test score. The third sub problem determines the highest test
score. The fourth sub problem prints the names of all the students whose test
scores are the same as the highest test score. The main algorithm combines the
solutions of the sub problems.)