0% found this document useful (0 votes)
42 views92 pages

Conditions Statement

The document presents a series of pseudocode questions and their multiple-choice answers, covering various programming concepts such as conditions, loops, and switch statements. Each question is designed to test the reader's understanding of pseudocode logic and syntax. The questions range from simple conditional checks to more complex scenarios involving variable manipulation and output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views92 pages

Conditions Statement

The document presents a series of pseudocode questions and their multiple-choice answers, covering various programming concepts such as conditions, loops, and switch statements. Each question is designed to test the reader's understanding of pseudocode logic and syntax. The questions range from simple conditional checks to more complex scenarios involving variable manipulation and output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Pseudo Codes - Conditions

Question 1
What will be the output of the following pseudocode?

#include <stdio.h>
int main()
{
int a = 10, b = 20, c = 30;
if (c > b > a)
printf("TRUE");
else
printf("FALSE");
}
Question 1

A) TRUE
B) FALSE
C) Compile Error
D) 1
Question 1

A) TRUE
B) FALSE
C) Compile Error
D) 1
Question 2
What will be the output of the following pseudocode?
If we pass input as : a=25, a=16
integer a
if((a mod 10) IS EQUAL TO 0)
a=a*2
else if((a mod 5 ) IS EQUAL TO 0)
a=a/5
else
a=a-1
Question 2

A) 5 15
B) 15 5
C) 25 5
D) Compile Error
Question 2

A) 5 15
B) 15 5
C) 25 5
D) Compile Error
Question 3
If switch feature is used, then .
a) default case must be present
b) default case, if used, should be the last case
c) default case, if used, can be placed
anywhere
d) none of the mentioned
Question 3
If switch feature is used, then .
a) default case must be present
b) default case, if used, should be the last case
c) default case, if used, can be placed
anywhere
d) none of the mentioned
Question 4
What will be the output of the following pseudocode?
#include <stdio.h>
using namespace std;
int main()
{
if (a = 0)
rintf ("a is zero");
else
printf ("a is not zero");
}
Question 4

A) a is zero
B) a is not zero
C) nothing
D) garbage
Question 4

A) a is zero
B) a is not zero
C) nothing
D) garbage
Question 5
What will be the output of the following pseudocode?
int main()
{
if( 4 > 5 )
{
printf("Hurray..\n");
}
printf("Yes");
}
Question 5

A) Yes
B) Hurray..Yes
C) Hurray..
D) Nothing
Question 5

A) Yes
B) Hurray..Yes
C) Hurray..
D) Nothing
Question 6
What will be the output of the following pseudocode?
int main()
{
if("abc")
{
printf("India\n");
}
if('c’)
{
printf("Honey\n");
}
printf("ZING");
}
Question 6

A) ZING
B) Honey
ZING
C) India
ZING

D) India
Honey
ZING
Question 6

A) ZING
B) Honey
ZING
C) India
ZING

D) India
Honey
ZING
Question 7
What will be the output of the following pseudocode?
#include <stdio.h>
void main()
{
if(!printf(""))
printf("Okkk");
else
printf("Hiii");
}
Question 7

A) Okkk
B) Hiii
C) Error
D) None
Question 7

A) Okkk
B) Hiii
C) Error
D) None
Question 8
What will be the output of the following pseudocode?
#include <stdio.h>
#define TRUE 1
int main()
{
if(TRUE)
printf("1");
printf("2");
else
printf("3");
printf("4");
Question 8

A) Error
B) 1
C) 12
D) 34
Question 8

A) Error
B) 1
C) 12
D) 34
Question 9
What will be the output of the following pseudocode?
#include <stdio.h>
void main()
{
int a = 1.0, b = 2, c = 3.12;
char d = 0.0;
if (a, b, c, d)
{
printf(“python");
}
}
Question 9

A) No Output
B) Error
C) python
D) .0
Question 9

No Output
A)
B) Error
C) python
D) 1.0
Question 10
What will be the output of the following pseudocode?
#include<stdio.h>
int main()
{
int x=2,y=0,z=3;
x>y ?( printf("%d", z)):( return z);
}
Question 10

A) 2
B) 3
C) Error
D) 11
Question 10

A) 2
B) 3
C) Error
D) 11
Question 11
What will be the output of the following pseudocode?
Integer a, b, c
Set b = 5, a = 2, c = 2
if(b>a && a>c && c>b)
b=a+1
lse a = b + 1
End if
Print a + b + c
Question 11

A) 2
B) 13
C) 26
D) 5
Question 11

A) 2
B) 13
C) 26
D) 5
Question 12
What will be the output of the following pseudocode?
int i=5, j=7;
if ( i+j> 5)
j = i+2;
if ( j<5 )
print(i)
else
print(j)
else
print(i+1)
Question 12

A) 12
B) 5
C) 7
D) 6
Question 12

A) 12
B) 5
C) 7
D) 6
Question 13
What will be the output of the following pseudocode?
Set p = 4;
q = 6;
r = 2;
p = p + q + r - 7;
q = p + r - 7;
if (p > q)
Print Hello
else
Print Hi
Question 13

A) Hello
B) Hi
C) Error
D) Hello Hi
Question 13

A) Hello
B) Hi
C) Error
D) Hello Hi
Question 14
What will be the output of the following pseudocode?
int main()
{
int a=97,b=97,c=98; if(c>a && c>b)
if(a>b && a>c) {
{ printf("%d ",c);
printf("%d ",a); }
} }
if(b>a && b>c)
{
printf("%d ",b);
}
Question 14

A) 98
B) c
C) b
D) 97
Question 14

A) 98
B) c
C) b
D) 97
Question 15
What will be the output of the following pseudocode?
int main() {
{ printf("%d",x);
int x=4,y=5,z=6; }
if(x+y>z) }
{ }
if(z>y) else
{ {
if(y>x) printf("%d",y);
Question 15

A) 6
B) 4
C) 5
D) Compile error
Question 15

A) 6
B) 4
C) 5
D) Compile error
Question 16
What will be the output of the following pseudocode?
Set a=3; b=5;c=1;
a=a+b+c/2;
b=a+b/2;
if(a>b)
Print Prime Mock
else
Printf Prime Video
Question 16

A) Prime Video
B) Prime Mock
C) Error
D) None of the above
Question 16

Prime Video
A)
B) Prime Mock
C) Error
D) None of the above
Question 17
What will be the output of the following pseudocode?

Input x =5,y = 7
x=x+1;
y=y+1;
x=x+y;
if(x%2==0) print x else print y
Question 17

A) 14
B) 5
C) 8
D) 10
Question 17

A) 14
B) 5
C) 8
D) 10
Question 18
What will be the output of the following pseudocode?
#include <stdio.h>
int main()
{
int k=25;
if (printf("%d",k))
printf("%d",k);
else
printf("Prime mock");
Question 18

A) Prime mock
B) 25 25
C) Value Error
D) 2525
Question 18

A) Prime mock
B) 25 25
C) Value Error
D) 2525
Question 19
What will be the output of the following pseudocode?
int main()
{
int p=3;
switch(p)
{
case 1:
printf(“python\n");
break;
case 2:
printf("Hello world\n");
case 3:
continue;
case 4:
printf(“java\n"); break;
Question 19

A) python
B) Error
C) Hello world
D) java
Question 19

A) python
B) Error
C) Hello world
D) java
Question 20
What will be the output of the following pseudocode?
Input p = 9, w = 6 ,
p=p +1;
w=w-1;
p=p+w
if (p > w)
rint p
else
print w
Question 20

A) 6
B) 5
C) 10
D) 15
Question 20

A) 6
B) 5
C) 10
D) 15
Question 21
What will be the output of the following pseudocode?
Input a = 30, b = 60, C = 90?
Integer a, b, c, sum
Read a, b, c
Set sum = a + b + c
if ((sum EQUALS 180) and (a NOT EQUALS 0) and (b NOT
EQUALS 0) and (c NOT EQUALS 0))
Print " Success"
Otherwise
Print "Fail"
End if
Question 21

A) Success
B) fail
C) Compilation error
D) None of the above
Question 21

Success
A)
B) fail
C) Compilation error
D) None of the above
Question 22
int main()
{
char ch;
ch = 'A';
printf("The letter is ");
printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch);
printf("\nNow the letter is ");
printf("%c\n", ch >= 'A' && ch <= 'Z' ? ch : ch + 'a' - 'A');
}
Question 22

A) Error
B) The letter is A Now the letter is a
C) The letter is a Now the letter is A
D) None of the mentioned
Question 22

A) Error
B) The letter is A Now the letter is a
C) The letter is a Now the letter is A
D) None of the mentioned
Question 23
How many times print statement execute of the following pseudocode?
Integer a, b, c
Set a = 8, b = 10, c = 6
If(a > c AND (b + c) > a)
Print a
end if
if(c > b OR (a + c) > b)
Print b
end if
if((b+c) MOD a EQUALS 0)
Question 23

A) 2
B) 3
C) 1
D) 0
Question 23

A) 2
B) 3
C) 1
D) 0
Question 24
What will be the output of the following pseudocode?
Integer p,q,r If((p+6)>(r-q))
Set p=7,q=6,r=10 r=(r+10)^r
if((q+p) <(5-q)) end if
if((q-p)>(p+q)) end if
q=10+r print p+q+r
p=q+p
r=(p+q)+q
End if
Else
Question 24

A) 55
B) 40
C) 46
D) 43
Question 24

A) 55
B) 40
C) 46
D) 43
Question 25
What will be the output of the following pseudocode?

#include <stdio.h>
int main()
{
int x = 12, y = 10, z = 13;
x+y<z ? printf("%d", z);
}
Question 25

A) Value of x
B) Value of y
C) Value of z
D) None of the above
Question 25

A) Value of x
B) Value of y
C) Value of z
D) None of the above
Question 26
What will be the output of the following pseudocode? Capgemini 2021
Integer p,q,r
Set p=9,q=7,r=4
r=q+r
if(p%p)
q=11+r
q=(q+p)+r
End if
Print p+q+r
Question 26

A) 27
B) 13
C) 34
D) 46
Question 26

27
A)
B) 13
C) 34
D) 46
Question 27
What will be the output of the following pseudocode? Capgemini2021
Integer a, b, c
Set b = 1
Set a = b + 3
Set c = 10
if ( a )
a=a-2
End if
if ( a )
a = 10
End if
a=a+b+c
Print a + b
Question 27

A) 21
B) 22
C) 28
D) 11
Question 27

A) 21
B) 22
C) 28
D) 11
Question 28
What will be the output of the following pseudocode?
Integer a, b, c
Set a = 3, b = 2, c = 3
If( a >> 1 && b>>1 )
a = a << 1
b=b+1
Else
b = b >> 1
c = c >> 2
End if
Question 28

A) 9
B) 12

C) 6
D) 3
Question 28

A) 9

B) 12

C) 6
D) 3
Question 29
What will be the output of the following pseudocode?
Integer a, b, c
set a = 108, b = 2, c = 3
if( a MOD 9 ) EQUALS 0 )
b = b + ( a MOD 2 )
printf b
else
c = c + (a MOD 7 )
printf c
Question 29

A) 2
B) 7
C) 1
D) 3
Question 29

2
A)
B) 7
C) 1
D) 3
Question 30
What will be the output of the following pseudocode if a=1 and b=2?
Code/Pseudo Code
1 dosometing(Integer a, integer b)
2 if (b EQUALS 1)
3 return 0
4 else
5 return a + dosometing(a,b-1)
6 end function dosometing()
7
8
9
10
11
12
13
14
Question 30

A) 2
B) 1
C) 3
D) 4
Question 30

A) 2
B) 1
C) 3
D) 4
THANK YOU

You might also like