G11 Lesson 01 Essay
G11 Lesson 01 Essay
G11 Lesson 01 Essay
1. Consider the execution of the following code segment containing a while loop. (2015)
sum = 0 Cycle No. sum N
N = 16
1
while N >= 10
sum = sum + N 2
N=N–2 3
end while
4
Copy the above table to your answer sheet and fill it using the values assigned for sum and N after the
execution of each cycle in the while loop.
2. A school has 1000 students. The following pseudocode segment prints the admission numbers of students
who attended the school everyday (i.e., 210 days) in a particular year: (2015)
N=0
while N < 100
get AdmissionNumber
get NumberOfDays
if NumberOfDays = 210 then
print AdmissionNumber
end if
N=N+1
end while
Draw a flowchart to represent the above pseudocode. (Use the same variable names as given in the
pseudocode in your flowchart.)
3. A teacher of a class of 35 students obtains the student preference to travel either by train or by bus on
their annual trip. The following flow chart with missing terms labelled from A to E represents this
scenario. (2015)
Write down the appropriate terms for the labels A to E. (Any variable names that are used in your answer
must be exactly as given in the question.)
Page 1|7
4. Consider the following program segment in Pascal. (2016)
var num : array [0 .. 4 ] of integer;
begin
num [0]:= 15;
num [2]:= 18;
num [4]:= 50;
num [1]:= num [4] + 10;
num [3] := num [0] + num [2];
for i = 1 to 4 do
writeln (num [i]);
end.
Page 2|7
7. Assume that a dice was thrown 10 times and the 10 values obtained are stored in an array named A.
The following algorithm with missing terms P, Q and R is used to calculate how many times
number 5 was obtained. (2017)
Index of array 0 1 2 3 4 5 6 7 8 9
A 1 3 5 3 2 1 5 4 6 1
count = 0
i=0
while i < P
if A |Q| = 5 then
R = count + 1
end if
i=i+1
end while
display count
Write the correct terms for labels P, Q and R in the above algorithms.
8. The following flowchart shows an algorithm that reads two numbers and display the smaller number .
Write the pseudocode for the algorithm in the flowchart given above. (2017)
9. The following flowchart reads three numbers and finds the smallest. Write down the correct expressions
for missing labels P and Q. (2017)
Page 3|7
10. Consider the given flowchart that finds the product of an integer with all the integers below it.
(E.g.: If N is the given integer then the product = 1 x 2 x 3 ... x N) (2018)
L and M are expressions to be completed.
(i) Write down the correct expressions for missing labels P, Q, R and S in the flowchart.
(ii) If the three decision boxes in the flowchart are combined into a single decision box, write down
the expression that should be used in that single decision box.
(iii) Write pseudocode representing the logic of the updated flowchart, including the changes that
were done in (i) and (ii) above.
(iv) When one or more of the input lengths become zero, this algorithm fails to function properly.
Write the pseudocode condition that has to be introduced in between the input and the first
decision box in the original flowchart to fix this problem.
Page 4|7
12. Following flowchart is used to input marks of three subjects. Then it calculates the displays the average
of those marks, and the pass/fail status. To be considered for a pass, the average should be greater than
or equal to 40. (2019)
Identify the correct statement for each of the labels P, Q, R and S in the flowchart from the table given
below. Write down the each label and its matching statement number.
13. Consider the following array A containing five integer values. (2019)
A[0] A[1] A[2] A[3] A[4]
80 100 70 65 95
Begin
Value = A[0]
k=1
WHILE (k<=4)
IF A[k] < Value THEN
Value = A[k]
ENDIF
k=k+1
ENDWHILE
DISPLAY Value
END
Page 5|7
14. A triangle with all three sides of equal length is called an equilateral triangle. A triangle with two sides
of equal length is called an isosceles triangle. A triangle with all slides of different lengths is called a
scalene triangle.
The following flowchart with labels P, Q, R determine if a given triangle is an equilateral, isosceles or a
scalene triangle. Write down the relevant statements for the labels P, Q and R. (2019)
15. Consider the following Pseudo-code segment with blank spaces labelled A to C, which calculates and
displays the sum of odd numbers between 0 and 10. Write down the suitable expression for A, B and C
in the label expression format. (2020)
BEGIN
sum = 0
num = 1
WHILE ..A..
sum = ..B..
num = ..C..
ENDWHILE
DISPLAY sum
END
16. Write one similarity and one difference between Variables and Constants in a computer program.(2020)
17. The following flow chart is drawn to calculate average marks (avg) and display the grades when marks
(M1, M2, M3) of three subjects are given as inputs. The grades are decide according to the following
table. (2020)
Page 6|7
Copy the above flowchart to your answer script and fill the blanks indicated by “?” according to the given
scenario.
18. Consider the following array A which contains zeros in all locations. (2020)
A[0] A[1] A[2] A[3] A[4] Begin
value = 2
0 0 0 0 0 k=0
REPEAT
A [k] = value
What would be the values of P, Q, R, S and T, after executing value = value + 5
k = k+ 1
the following Pseudo-code on array A. UNTIL k < 5
A[0] A[1] A[2] A[3] A[4] END
P Q R S T
Page 7|7