1
1 2
1 2 3
Pseudocode:
integer i=1 //STATEMENT 1
while(i<=3)
{
int j //STATEMENT 2
while (j<=i) //STATEMENT 3
{
print j
print blank space
j=j+1 //STATEMENT 4
}
Print end-of-line
i=i+1
}
Identify the incorrect statement.
A.STATEMENT 4
B.STATEMENT 3
C.STATEMENT 2
D.STATEMENT 1
E.NO ERROR
C
Sum of the first 10 multiples of 10.
Integer i=0 //Statement 1
Integer sum=0 //Statement 2
While(i<=1000){ //Statement 3
sum=sum+i //Statement 4
—MISSING STATEMENT—
}
Print sum
Identify the missing statement and the incorrect statement.
A. i=5
Statement 1
B.i=10*i
Statement 2
C.i=i+10
Statement 3
D.i=i+1
Statement 4
C
Function fun(){
Input num=40
Return num – –
}
Function main()
{
for(fun() ; fun() ; fun()) {
print fun();
}
Predict the output.
38 35 32 29 26 23 20 17 14 11 8 5 2
Function main()
char *s[] = { “knowledge”,”is”,”power”}
char **p
p = s
print ++*p
print *p++
print ++*p
A. nowledge nowledge s
B. knowledge knowledge is
C. knowledge nowledge s
D. is power
A
How many times the loop will execute?
for X=5 to 1
for Y=1 to X
print Y
A.12
B.13
C.14
D.15
D
Function foo(int* a, int* b)
sum = *a + *b
*b = *a
RETURN *a = sum – *b
Function main()
int i = 0, j = 1, k = 2, l;
l = i++ OR foo(&j, &k)
print(i, j, k, l)
A.1 2 1 1
B.1 1 2 1
C.1 2 2 1
D.1 2 2 2
A
Read count=5
Set x to 0;
While(x < count)
Set even to even + 2
x = x + 1
write even
A.2 4 6 8 10
B.0 2 4 6 8
C.2 4 6 8
D.0 2 4 6
B
begin
q := 0 // q is going to contain floor(x/y)
r := x // r is going to contain x % y
// Repeatedly subtract y from x.
while r >= y do
begin
r := r – y
q := q + 1
end
end
The post condition that needs to be satisfied after the program terminates is
(A) {r = qx + y ∧ r < y}
(B) {x = qy + r ∧ r < y}
(C) {y = qx + r ∧ 0 < r < y}
(D) { q + 1 0}
B
READ m = 10
Initialize n & n1
n = m++
n1 = ++m
n–
–n1
n -= n1
Write n
(A) 0
(B) 1
(C) -2
(D) None of these.
C
Function f(int* p, int m)
m = m – 5
*p = *p – m
return;
EndFunction
Function main()
Input i=10, j=5
f(&i, j)
print i+j
A )5
B) 25
C) 15
D) 30
C