Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

PRACTISE QUESTIONS -PROGRAMMING

I. Programming using simple instructions:

1. WAP to input two numbers, calculate and output the total.


2. WAP to input two numbers, calculate and output the difference.
3. WAP to input two numbers, calculate and output the product.
4. WAP to input two numbers, calculate and output the quotient.

II. Programming using input prompts and output messages (Use prompts from this point
onwards):

1. WAP to input two numbers, calculate and output the remainder.


2. WAP to input Principal, Time, Rate to calculate and output simple interest using the
formula SI=P*T*R/100.
3. WAP to input temperature in Fahrenheit, convert and output it in Celsius using the
formula C= (F-32)*5/9.

III. Programming using simple “IF” condition:

1. WAP to input a number and output a message to say if it is a negative or positive


number.
2. WAP to input a number and output a message to say if it is an odd or even number.
3. WAP to input two numbers and output the biggest.
4. WAP to input index, Islam, Dhivehi, Maths, English marks of a student, calculate and
output the total and average. Also output if the student passed or failed.
Criteria: average less than 50 is fail.

IV. Programming using “NESTED IF” conditional statements:

1. WAP to input three numbers and output the biggest number.


2. WAP to input index, Islam, Dhivehi, Maths, English marks of a student, calculate and
output the total and average. Using nested if condition output the overall grade the
student achieved and output if the student passed or failed.
Criteria: average 50 and above is pass.
Criteria: A is 75-100; B is 65 – 74; C is 50 – 64; D is 40-49; E is 25 to 39; F is 0-24

©AIS COMPUTER SCIENCE PRACTISE QUESTIONS – PROGRAMMING Page 1 of 4


V. Programming using “While…End while” Loop:

1. WAP to input ten numbers, calculate and output the total and average of all numbers.
2. WAP to input ten numbers calculate and output the count of negative and count of
positive numbers.
3. WAP to input ten numbers calculate and output the sum of negative and sum of positive
numbers.
4. WAP to input ten numbers calculate and output the count of odd and count of even
numbers.
5. WAP to input ten numbers calculate and output the sum of odd and sum of even
numbers.
6. WAP to input index, name, class, Maths marks of 30 students of a class and output the
count of students that had passed and failed.
7. WAP to input ten numbers, and output the largest and smallest number.
8. A country has four mobile phone network operators. Each mobile phone number has
eight digits. The first three digits identify the network operator:
444 Yodafone
555 N2 network
666 Kofee mobile
777 Satsuma mobile
Write an algorithm, using pseudocode or flowchart only, which reads 50 000 eight-digit
mobile phone calls made during the day and outputs the number of calls made on each
of the four networks. (MJ 2013)

VI. Programming using For…Next Loop:

REDO THE ABOVE QUESTIONS USING FOR LOOP

VII. Programming using Repeat…Until Loop:

REDO THE ABOVE QUESTIONS USING REPEAT…UNTIL LOOP

©AIS COMPUTER SCIENCE PRACTISE QUESTIONS – PROGRAMMING Page 2 of 4


VIII. Questions to improve programming skills and practise tricks and techniques.

1. WAP to generate numbers from 1 to 20.


2. WAP to generate even numbers from 2 to 40.
3. WAP to generate odd numbers from 1 to 20.
4. WAP to generate numbers up to infinity.
5. WAP to input a number and output a message saying if it is prime number or not.
6. WAP to input a number and output the sum of the digits of the number.
7. WAP to input a number and check if it is an Armstrong number.
8. WAP to generate Fibonacci series up to the number of elements the user inputs.

IX. Programming using ARRAYS:

1. WAP using an array to input ten numbers calculate and output the total and average.
Also output all the input numbers.
2. WAP using an array to input ten numbers count and output the count of negative and
count of positive numbers and also output the first five numbers that were input.
3. WAP using an array to input ten numbers calculate and output the sum of negative and
positive numbers and also output the last five numbers that were input.
4. WAP using an array to input ten numbers and output the count of odd and count of
even numbers and also output the input numbers in the even number order of inputs.
5. WAP using an array to input ten numbers calculate and output the sum of odd and even
numbers and also output the input numbers in the odd number order of input.
6. WAP using an array, to input ten numbers and output the smallest and biggest number
and also output all the input numbers in the reverse order.
7. WAP using an array, to input ten numbers and output the smallest and biggest number
and also output the order of the smallest and biggest number in the input sequence.
Example: Smallest is 2 and it is the 5th number
Biggest is 24 and it is the 9th number
8. WAP using an array to input ten numbers and output them in the descending order.
9. WAP using array concept, to input index, name, class, Islam, Dhivehi, English, Maths
marks of 50 students and in the end output only details of those students that have
achieved 50 or above in all four subjects.

©AIS COMPUTER SCIENCE PRACTISE QUESTIONS – PROGRAMMING Page 3 of 4


10. WAP using an array to input and store index, name, class, height and weight of 30
students of a class.
Calculate and output:
 total height, total weight, average height, and average weight
 smallest height along with the name, index and class
 largest height along with the name, index and class
 smallest weight along with the name, index and class
 largest weight along with the name, index and class.
11. WAP using an array to input and store temperature in Celsius, pressure and rainfall
values of a day for a month.
 If temperature was less than 10 output "abnormal", if it was between 10 to 35
output "normal” and if it was greater than 35 output "extreme".
In the end output the following:
 For the lowest temperature recorded, output the temperature, pressure and
rainfall on that day.
 For the highest temperature recorded, output the temperature, pressure and
rainfall on that day.
 If rainfall is 15 or above for minimum of 20 days then output "wet season" else
output "dry season"
 If pressure input is greater than or equal to 800 for a minimum of 28 days then
output "high pressure build-up" else output "normal pressure".
 Also calculate and output in Fahrenheit the total temperature, average
temperature, lowest and highest temperature
12. WAP to input and store index, name, class, gender, join date and leaving date of 50 students
of a tuition centre for a particular year. Check if the leaving date is lesser than join date and if
so count it as an error. Students cannot leave in the same month they joined.
In the end output the following:
 the number of errors
 the details of the students with error records
 the number of girls whose records were with errors
 the number of boys whose records were with errors.
Example data: (month year)
Join date: 114; Leaving date: 914

©AIS COMPUTER SCIENCE PRACTISE QUESTIONS – PROGRAMMING Page 4 of 4

You might also like