0% found this document useful (0 votes)
17 views

Selection Statements Questions

these are some practice questions for computer science
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Selection Statements Questions

these are some practice questions for computer science
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Write an algorithm using pseudocode which inputs the temperature for a


day,and check if the temperature is above freezing point or not.

2. Write a program using pseudocode to input three temperature readings of


a day and output the highest and lowest temperatures
3. A greenhouse monitors the temperature and oxygen levels
which are required to be maintained at a certain level. The
temperature must be between 21.1 and 25.6 (inclusive) and
the oxygen levels must be below 13. Write a program which
input the temperature and oxygen readings of the green
house and output the appropriate messages.
4.
5. An online food ordering company offers the following menu:

Category Food item Price

Sweets & Desserts Cakes & muffins 120& each

Ice cream 100$ per scoop

Snacks Pizza Fries 150$ single serving

Chicken Strips 200$ single serving

Wontons 100$ single serving

Write an algorithm using pseudocode,which


● Inputs the category (Sweets & desserts or Snacks) from the customer
○ Input the choice of food item for the selected category
● Output the bill
Q. The police use the following program to decide upon a course of action
once the speed of a car has been recorded. What action will the system
recommend if the value of speed is 32?
IF speed > 40 THEN
PRINT(“Confiscate license”)
ELSEIF speed > 35 THEN
PRINT(“Issue summons to court”)
ELSEIF speed >30 THEN
PRINT(“Issue fine”)
ELSE
PRINT(“No action necessary”)
ENDIF

Q. Write pseudocode, program and draw flowchart that gives you a different
greeting
depending on the time of day you input in hours. The following conditions are
given:
● If hours are less than 12, displays good morning
● If hours are less than 18 but greater than 12, displays good afternoon
● If hours are less than 22 but greater than 18, displays good evening
● Otherwise displays good night.

Q. Write a pseudocode, program and flowchart to input a name and a registration


code of a member for an upcoming event and check that the name field should
not be left unfilled and the number of characters in the code must be five. Display
prompt message and give an opportunity to re-enter the data in case of wrong
entry.

Q. Write a program to input the age of a user. If the user is aged 21 or over, then
check his salary. If their salary is over 15,000 the flat rental is allowed, otherwise he is
informed that he doesn’t earn enough to rent the flat. If the user is aged 18 to 20, then a
guarantor is required. If he has a guarantor, he is told that the guarantor details are
needed, otherwise he is told that he must have a guarantor. Otherwise the user must
be under 18, so he will be informed that he can't rent the flat.

Q. Write a pseudocode to input number and find whether the entered number is odd or
even?
Q. Write pseudocode to take values of length and breadth of a rectangle from the user
and check if it is square or not.

Q. A shop will give a discount of 10% if the cost of the quantity purchased is more than
1000. Ask the user for quantity. Suppose, one unit will cost 100. Judge and print total
cost for the user.

Q. A company decided to give a bonus of 5% to an employee if his/her year of service is


more than 5 years. Ask the user for the salary and year of service and print the net
bonus amount.

Q. A student will not be allowed to sit an exam if his/her attendance is less than 75%.
Take following input from user:
● Number of classes held
● Number of classes attended.
● And print percentage of class attended
● Is a student allowed to sit in the exam or not?

You might also like