Pseudocode
Pseudocode
PESUDOCODE
FOR i=1 to 4
FOR j= 1 to 4
IF i=j THEN
DISPLAY i*j
ELSE
DISPLAY i+j
END IF
END FOR
END FOR
Option:
a)1, 3, 4, 5,
3, 4, 5, 6,
4, 5, 9, 7,
5, 6, 7, 16
b)1234
5678
9 10 11 12
c)1112
2233
3444
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
5556
ANS)A
FOR i=1 TO 3
FOR j =1 TO i
PRINT(‘*’)
Option:
a)* *
**
**
b)*
**
***
c)***
**
d)*
**
***
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
ANS)B
FUNCTION checkNumber(num):
RETURN TRUE
ELSE
RETURN FALSE
END IF
END FUNCTION
a)true
b)false
c)7
d)error
ANS)b)FALSE
Note: count Vowel(string) returns the number of vowels in the string. Ex- countVowel("okay”) return is 2
isPalin(string) returns 1 if the string is a palindrome, otherwise returns 0. Ex- isPalin("yyy") returns 1. Upper(string)
converts all the letters of the string to upper case. Ex-upper("OkaY") would return "OKAY"
Option:
a)3
b)5
c)2
d)6
ANS)b)3
FUNCTION computeFactorial(n)
RETURN 1
ELSE
RETURN n * computeFactorial(n-1)
ENDIF
END FUNCTION
What is the output when the function <code>computeFactorial</code>is called with the argument
<code>5</code>?
Option:
a)5
b)120
c)25
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
d)error
ANS) b)120
FUNCTION concatenateStrings(arr)
result=””
ENDFOR
RETURN TRIM(result)
ENDFUNCTION
arr = [“Hello”,”world”,”!”]
PRINT concatenateStrings(arr)
Option:
7)considering the given pseudocode for traversing a binary tree using in-order traversal you need to identify the
output sequence for the tree structural provided
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
FUNCTION Traversal(node)
Traversal(node.left)
PRINT node.value
Traversal(node.right)
END IF
END FUNCTION
/\
26
/\ /\
1357
Option:
a)1,2,3,4,5,6,7
b)4,2,1,3,6,5,7
c)1,3,2,5,7,6,4
d)7,6,5,4,3,2,1
ANS) a)1,2,3,4,5,6,7
8)What will be the output of the depicted pseudo code for a=3, b=4?
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
if ((b-a)>(a&b) &&b<5)
a =(a+3)+a
return funn(b,b)+funn(b+2,b+1)
End if
return a-b+1
Note-&&: logical AND-The logical AND operator (&&) returns the Boolean value true (or 1) if both operands are true
and returns false (or 0) otherwise.
&: bitwise AND The bitwise AND operator (&) compares each bit of the first operand to the corresponding bit of the
second operand. If both bits are 1, the corresponding result bit is set to 1.
a)0
b)4
c)3
d)12
ans)c)3
n<-Length of arr
if i mod 2 = 0 then
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
arr[i]<-arr[i]*2
else
arr[i]<-arr[i]+1
endIF
endfor
PRINT arr
End Function
What will be the output when the function ‘modifyArray’ is called with the input array[1,2,3,4,5]?
Option:
a)[1,4,4,8,6]
b)[2,4,4,8,6]
c)[1,3,4,7,5]
d)[2,5,6,9,7]
Ans: d) [2, 5, 6, 9, 7]
SET A to (1, 2, 3, 4, 5)
SET B to (4, 5, 6, 7, 8]
SET C to {}
ADD element TO C
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
END IF
END FOR
ADD element TO C
END IF
END FOR
PRINT C
What will I be the output of this pseudocode? Select the correct option from the given choices
Option:
a){1,2,3,4,5,6,7,8}
b){1,2,3,6,7,8}
c){4,5,6,7,8}
d)Error
ANS) a){1,2,3,4,5,6,7,8}
Function recursiveFunction(n)
Initialize counter=0
If n<=0
Return 1
Else
counter=counter+recursiveFunction(n-1)
End If
Return counter
End Function
set n=some_value
Print recursiveFunction(n)
How many times is the function called when recursiveFunction (4) is executed? Select the correct option
Option:
a)12
b)7
c)8
d)11
Ans: d)11
Integer pp,qq,rr
pp=(rr&8) +qq
if((qq+rr)>(rr-qq)
qq=12&PP
Else
qq=pp&pp
if((pp^5)<(10+pp))
End if
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
End if
Print pp+qq+rr
Note -&:bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the corresponding bit
of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result
bit is set to 0.
^ is the bitwise exclusive OR operator that compares each bit of its first operand to the corresponding bit Its serond
operarid. If une bit tis 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding
result bit is set to 0
a)34.0
b)41.0
c)30.0
d)46.0
ANS) a)34.0
Integer a,b,c
if((c^b^a)<(a^c))
b=a+b
if((b&4)<a)
a=(6&11)+c
Else
a=9+a
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
End if
b=5+c
End if
b=8+a
Print a+b+c
Note -&:bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the corresponding bit
of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result
bit is set to 0.
^ is the bitwise exclusive OR operator that compares each bit of its first operand to the corresponding bit Its serond
operarid. If une bit tis 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding
result bit is set to 0
a)33.0
b)38.0
c)30.0
d)47.0
ANS)a)33.0
Switch (status)
Case Status.New:
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
result = 5
Case Status.InProgress:
result = 10
Case Status.Completed:
result = 20
result = 0
End Switch
result= result * 2
if (status==Status.Completed) then
result = result + 5
endif
else
result -1
endif
Option:
a)20,45,-1,10
b)12,45,0,8
c)24,42,-1,10
d)20,45,-1,11
ANS) a)20,45,-1,10
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
15)you are asked to write arithmetic routines and put everything in a single routine write sample snippet code for
that
a)def calculatorOperation()
switch(operation)
break;
break;
15000
Begin
SET c=Color.GREEN
case с OF
end case
end
(R) What is the pseudocode to convert the enumerated type Color to a list?
Analyze the given choices and select the option with the correct set of answers
Option:
a)Begin
For i=1 to 3
next i
End For
End
b)Begin
For i=1 to 3
next i
End For
End
16)you need to search number using binary search.write a sample snippet of code that searches a number
Target=7
Option:
a)1. Get all set of numbers as list and arrange in ascending order
3. Get the middle number of the list and check if given number=middle number true, display it is found
4. else check whether the given number less than middle number and if so recursively need to do binary search with
first nümber as start number and last number as middle number of earlier one-1
5. This entire routine runs recursively and finally if number is found display it is found else display it is not found.
Stop
b)1.get all the set of numbers as list and arrange in ascending order
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
3)get the middle number of the list and check if the given number = middle number true display it is found
Set a to 5
Set b to 3
What is the value of the result variable after the execution of the code
Option:
a)true
b)false
c)error
d)none
ans)a)true
18)what will be the output of the following pseudocode that uses control statements to determine the grade based
on the given score?
FUNCTION determineGrade(score)
IF score>=90
RETURN ‘A’
ELSEIF score>=80
RETURN ‘B’
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
ELSEIF score>=70
RETURN ‘C’
ELSEIF score>=60
RETURN ‘D’
ELSE
RETURN ‘F’
ENDIF
END FUNCTION
PRINT determineGrade(85)
Option:
a)A
b)B
c)C
d)D
ans)b)B
1 CLASS BLOCK123
2 Int abc;
3 FUNCTION BLOCK12)(int x)
4 SET abc=x
5 end FUNCTION
6 end class
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
7 BEGIN
10 END
(A) What is the right pseudocode to initialize the object 'ohy with o default integer value al 100 for variable abc?
(B) The above code of the class 'BLOCK123 is upriated as shown below is the below implementation allowed?
CLASS BLOCK123 int abc FUNCTION BLOCK1230 SET abr 200 end FUNCTION FUNCTION BLOCK1230 print abc end
FUNCTION end class
Analyze the given choices and select the option with the correct set of answers.
A (A)FUNCTION BLOCK123(int y)
SET abc=y
end FUNCTION
end FUNCTION
(B) Two default constructors are not allowed, only one is allowed
SET x= 100
SET abc=x
end FUNCTION
20. Analyze the given pseudocode which illustrates the application of classes and objects through an inventory
management system
1 CLASS Product
2 PROPERTY name
3 PROPERTY quantity
4 PROPERLY price
6 METHOD Constructor(n, q. p)
7 self.name
8 self. quantity= q
9 self. Price=p
10 END METHOD
11
12 METHOD UpdateQuantity(newQuantity)
13 self.quantity = newQuantity
14 END METHOD
15
16 METHOD DisplayProduct()
self.price
18 END METHOD
19 END CLASS
20
22 product.UpdateQuantity(30)
23 product. DisplayProduct()
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
What will be the output of the DisplayProduct method after the quantity update?
1 procedure modify_value(pointer)
2 *pointer = *pointer * 2
3 end procedure
5 procedure main()
6 x=5
7 pointer_x = address of x
8 modify_value(pointer_x)
9 output "x=", x
10 end procedure
a)5
b)10
c)20
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
d)15
1 FUNCTION identifytype(value)
5 RETURN ‘Boolean’
6 ELSE
7 RETURN ‘Unknown’
8 END IF
9 END FUNCTION
10
11 result= identifyType(true)
DISPLAY result
a)Floating Point
b)Boolean
c)Unknown
d)True
1 FUNCTION checkDatatype(value)
3 RETURN 'Integer’
5 RETURN 'String’
6 ELSE
7 RETURN ‘Other’
8 END IF
9 END FUNCTION
10
11 result = checkDataType(5)
12 DISPLAY result
a)Integer
b)String
c)Float
d)Error
1 FUNCTION identifytype(value)
5 RETURN "Boolean’
6 ELSE
7 RETURN Unknown
8 END IF
9 END FUNCTION
10
11 result= identifyType(true)
12 DISPLAY result
Select an option
a)Floating Point
b)Boolean
c)Unknown
d)True
string str1="hide",str2="race"
Print isPalin(lower(str2)+str1)+countVowel(str1)
Note: countVowel(string) returns the number of vowels in the sting. Ex countVowel("okay") returns2. isPalin(string)
returns 1 if the string is a palindrome, otherwise retuns 0. Ex isPalin("yyy") retums 1. lower(string) converts all the
letters of the string to lowercase. Ex-lower ("Okay") will return "okay
a)2
b)4
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
c)0
d)5
26. What will be the output of the given pseudo code? Select the correct option from the given
choices
1 Integer p,q,г
3 for(each r from 4 to 5)
4 p-(12+5)+p
5 End for
6 for(each r from 2 to 5)
7 q=5+q
8 End for
9 r-r+p
10 Print p+q
Select an option
a)59
b)63
c)61
d)69
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
1 Integer j
3 arr[3]=5&arr[2]
4 for(each from 4 to 5)
7 End for
8 arr[1]-arr[2]+arr[1]
9 Print arr[2]+arr[3][/code
a)0
b)4
c)2
d)8
1 integer j
3 arr[0]-(arr[2]&arr[0])+arr[2]
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
4 for(each j from 4 to 7)
6 End for
7 arr[e]-(arr[2]85)+arr[3]
8 Print arr[2]+arr[3]
Note mod finds the remainder after the division of one number by another. For example, the expression "5 mod 2"
will evaluate to 1 because 5 divided by 2 leaves a quotient of 2 and a remainder of 1
& bitwise AND- The bitwise AND operator (&) compares each bit of the first operand to the corresponding bit of the
second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is
set to 0.
a)35.0
b)28.0
c)7.0
d)21.0
1 LIST=[13, 0, 4, 5, 2]
5 TEMP LIST[1]
6 LIST[1] LIST[3]
7 LIST[j] TEMP
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
END IF
9 END FOR
10 END FOR
11 PRINT LIST
What will be the output of this pseudocode? Select the correct option from the green choices
a) [0,2,3,4,5]
b) [3,0,4,5,2]
c) [4,3,2,0,5]
d) [1,0,2,3,4]
1 Class Rectangle:
3 self.length length
4 Self.width= width
6 Method calculate_area():
9 My_rectangle Rectangle(4, 5)
10 Area_result - My_rectangle.calculate_area()
Which of the following options correctly represents the result of calling the 'my_rectangle' object? <7 calculate area
method on
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
a)20
b)9
c)1
d)45
31. What will be the output of the given pseudo code for a9b-6, and ca?
2 а-(ана) с
3 for(each c from 3 to 6)
4 6=6+c
5 a=(4+4)+b
6 b=(c+b)+c
7 End for
return a+b
a)63
b)51
c)40
d)44
1 set i =10
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
2 set j=20
3 Set x1 address of i
4 Set x2 address of j
Select an option
a. "x1"x1 + x2
10
b. "x2"x1"x2
7814/23
c. "x1"x1 x2
12
34. What will be the output of the following pseudo code for a 7, b=5, c=47
2 for(each c from 4 to 5)
3 b-(5+10)+c
4 End for
5 for(each c from 5 to 6)
6 b-12+a
7 End for
8 return a+b
Select an option
a)25
b)27
c)26
d)36
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
35. Analyze the following pseudocode. What will be the output after its execution?
1 FUNCTION fun(n)
2sum = 0
3FOR i = 1 TO n
4 IF i % 2 == 0
5 sum = sum + i
6 ENDIF
7 ENDFOR
8 RETURN sum
9 ENDFUNCTION
10
Select an option
30
25
40
15
1 str = ‘123abc’
2 pattern =’\d+’
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
4 print(match)
abc
123
123abc
123ab
37. Analyze the depicted pseudocode that defines a class and its methods for handling data within objects:
1 CLASS Book
2 PROPERTY title
3 PROPERTY author
4 PROPERTY pages
6 METHOD Constructor(t, a, p)
7 self.title = t
8 self.author = a
9 self.pages = p
10 END METHOD
11
12 METHOD DisplayInfo()
16 END METHOD
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
17 END CLASS
18
20 b.DisplayInfo()
What will be the output when the DisplayInfo method is executed? Select the correct option from the
1 String stri-"tide",str2-"ookk"
2.Print countconso(str2+str3)+ispalin(stri+reverse(str2))
Note: countConsočstring) returns the number of consonants in the string. Ex count Conmoclknytn
2 isPalin(string) returns 1 if the string is a palindrome, otherwise returns D. Ex Palinyyy returne 1 reverse(string)
reverses the string. Ex- reverse("okaY") returns "Yako"
1 Integer a,b,c
3 for(each c from 5 to 6)
4 a(c^9)*c
5 A=12&a
6 End for
7 Print a+b
12
15
19
33
1 CLASS BLOCK123
2 int abc;
3 FUNCTION BLOCK123(int x)
4 SET abc-x
5 end FUNCTION
6 end class
7 BEGIN
10 END
(A) What is the right pseudocode to initialize the object 'obj with a default integer value of 100 for variable ABS abc?
(B) The above code of the class 'BLOCK123' is updated as shown below. is the below implementation 3636\allowed?
CLASS BLOCK123 int abc FUNCTION BLOCK1230 SET abc-200 end FUNCTION FUNCTION BLOCK1230 Print abc end
FUNCTION end class
Analyze the given choices and select the option with the correct set of answers.
A) FUNCTION BLOCK123(int y)
SET abc=y
end FUNCTION
end FUNCTION
(B) Two default constructors are not allowed, only one is allowed
SET x=100
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
SET abc=x
end FUNCTION
1 CLASS BLOCK123
2 int abc;
3 FUNCTION BLOCK123(int x)
4 A SET abc-x
5 end FUNCTION
6 end class
7 BEGIN
10 END
(A) What is the right pseudocode to initialize the object 'obj’ with a default integer value of 100 for variable abc?
(B) The above code of the class 'BLOCK123" is updated as shown below. Is the below implementation allowed?
CLASS BLOCK123 int abc FUNCTION BLOCK1230 SET abc-200 end FUNCTION FUNCTION BLOCK1230 print abc end
FUNCTION end class
Analyze the given choices and select the option with the correct set of answers.
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
end FUNCTION
(B) Two default constructors are not allowed, only one is allowed
SET x=100
SET abc=x
end FUNCTION
end FUNCTION
(B) Always include the prefix 'cons' for defining the second default constructor
6 ADO element TO D
7 END FOR
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
9 IF element NOT IN D
10 ADD element TO D
11 END IF
12 END FOR
14 IF element NOT IN D
15 ADD element TO D
16 END IF
17 END FOR
19 PRINT D_SORTED
What will be the output of this pseudocode? Select the correct option from the given choices.
{10,20,30,40,50}
{10,20,30,40,30,50}
{30,40,50,20,10}
{50,40,30,20,10}
43. Consider the given codes and choose the option that is associated with these codes.
Code 1:
Code 2:
2----
3 end function
1 halfterm_marks= [53,60,80]
4 print average_mark(halfterm_mark)
Formal Parameter-set_of_marks
Actual Parameter-hallterm_mark
Formal Parameter-halfterm_mark
Formal Parameter-average_marks
Actual Parameter-halfterm_marks
Formal Parameter-halfterm_marks
Actual Parameter-average_marks
1. Integer p, q, r
3. for(each r from 3 to 7)
4. p = (r+r) + r
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
5. if((r+q)<(q-r))
6. Continue
7. Else
8. p= r+r
9. r=(8+7)&q
10. End if
Note:
1. Continue: When a continue statement is encountered inside a loop, control jumps to the beginning
of the loop for the next iteration, skipping the execution of statements inside the body of the loop
for the current iteration.
2. &: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the
corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
Options:
1. 18
2. 14
3. 25
1. Integer p, q, r
3. for(each r from 5 to 8)
4. p=p+q
5.
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
6. if(p<r)
7.
8. Continue
9.
10. Else
11.
13.
14. End if
15.
16. q=(p+q)&q
Note:
1. Continue: When a continue statement is encountered inside a loop, control jumps to the beginning
of the loop for the next iteration, skipping the execution of statements inside the body of the loop
for the current iteration.
2. &: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the
corresponding bit of the second operand. If both bits are 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
Options:
1. 20
2. 26
3. 9
4. 14
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Integer a, b, c
b=a+b
c=(c+7)^b
b=(12&10)+c
Print a+b+c
Note:
&: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the corresponding
bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the
corresponding result bit is set to 0.
^: bitwise XOR - The bitwise XOR operator (^) compares each bit of its first operand to the corresponding
bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0
Options:
1. 12
2. 39
3. 30
4. 27
Integer a, b, c
if((c^b^a)<(a^c))
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
a=(4+8)+b
Else
if((a+b)>(b-a))
c=1+a
a=(c^c)+b
Else
c=7&c
End if
c=c+c
End if
b+c
Print a+b+c
Note:
&: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the corresponding
bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the
corresponding result bit is set to 0.
^: bitwise XOR - The bitwise XOR operator (^) compares each bit of its first operand to the corresponding
bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
Options:
o 17
o 44
o 32
o 38
5. Integer p, q, r
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
q=(2+4)+r
p=r+r
if((3+q+r)>(r+p))
p=7&r
Else
r=(q&11)+r
End if
r=p+r
Else
r=(p^p)+r
End if
p=(p+p)&p
Print p+q+r
Note:
&&: Logical AND - The logical AND operator (&&) returns the Boolean value true (1) if both operands are
true, and returns false (0) otherwise.
&: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the corresponding
bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the
corresponding result bit is set to 0.
^: bitwise XOR - The bitwise XOR operator (^) compares each bit of its first operand to the corresponding
bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
rr=(rr+12)+qq
if((pp+qq)>(qq+pp))
pp=rr^pp
End if
rr=qq+qq
qq=pp+rr
Else
qq=pp+rr
End if
rr=(4+4)^pp
qq=10+pp
Print pp+qq+rr
Note:
&&: Logical AND - The logical AND operator (&&) returns the Boolean value true (1) if both operands are
true, and returns false (0) otherwise.
^: bitwise XOR - The bitwise XOR operator (^) compares each bit of its first operand to the corresponding
bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
Options:
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
5. 27
6. 38
7. 31
8. 30
Integer a, b, c
b=2+a
for(each c from 4 to 5)
b=9^b
b=10^b
End for
c=(1^9)+c
Print a+b
Note:
^: bitwise XOR - The bitwise XOR operator (^) compares each bit of its first operand to the corresponding
bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
Options:
9. 14
10. 3
11. -2
12. 4
1. Integer a, b, c
2. Set a = 7, b = 5, c = 9
4. a = 12 + c
5. a = (a ^ b) + a
6. End for
7. c = (b & 4) & a
8. Print a + b
&: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the corresponding
bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the
corresponding result bit is set to 0.
^: bitwise XOR - The bitwise XOR operator (^) compares each bit of its first operand to the corresponding
bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
Options:
13. 55
14. 46
15. 40
16. 49
3. a = (b + 3) + a
4. a=1+a+b
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
5. return funn(b, b) + b
6. End if
7. a = 2 + 2 + a
8. return a - b + 1
&&: Logical AND - The logical AND operator (&&) returns the Boolean value true (1) if both operands are
true, and returns false (0) otherwise.
Options:
21
12
13
17
10. What will be the output of the following pseudo code for a = 5, b = 9?
3. b=2+3+b
4. a=a+1
5. return b - funn(a, a + 2)
6. End if
7. b = b + 2
8. return b - a + 1
Note:
&&: Logical AND - The logical AND operator (&&) returns the Boolean value true (1) if both operands are
true, and returns false (0) otherwise.
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Options:
1. 9
2. 6
3. 10
4. 21
11. What will be the output of the following pseudo code for a = 0, b = 23?
3. a=b+3
4. a=a+1
5. a=3+3+b
6. return funn(a + 1, b)
7. End if
8. return b - 1
&&: Logical AND - The logical AND operator (&&) returns the Boolean value true (1) if both operands are
true, and returns false (0) otherwise.
&: bitwise AND - The bitwise AND operator (&) compares each bit of the first operand to the corresponding
bit of the second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the
corresponding result bit is set to 0.
^: bitwise XOR - The bitwise XOR operator (^) compares each bit of its first operand to the corresponding
bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1.
Otherwise, the corresponding result bit is set to 0.
Options:
1. -5
2. 1
3. 6
4. 18
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
2. for(each c from 2 to 5)
3. a = (c + a) + c
5. continue
6. Else
7. b = (c + 10) + c
8. End If
9. End for
10. return a + b
Note:
1. continue: When a continue statement is encountered inside a loop, control jumps to the beginning
of the loop, skipping the execution of statements inside the body of the loop for the current
iteration.
Options:
1. 32
2. 41
3. 36
4. 49
3. a = (3 + 6) + a
5. b = 12 + b
6. End if
7. b = (10 + 12) + a
8. End if
9. a = (a + 10) + c
10. return a + b + c
Options:
1. 33
2. 40
3. 56
4. 37
1. Integer p, q, r
2. Set p = 3, q = 4, r = 4
3. for(each r from 3 to 7)
5. Continue
6. End if
7. p = (q ^ p) + p
8. p = (r + 6) & r
9. End for
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
10. Print p + q
Note:
continue: When a continue statement is encountered inside a loop, control jumps to the beginning of the
loop, skipping the execution of statements inside the body of the loop for the current iteration.
^: bitwise XOR
Options
1. 2
2. 15
3. 7
4. 11
1. Integer p, q, r
2. Set p = 8, q = 4, r = 6
3. for(each r from 2 to 3)
4. if((p ^ 5) < 5)
6. End if
7. q = (6 ^ 6) + p
8. q=7+p
9. End for
10. Print p + q
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
^: bitwise XOR
Options:
1. 23
2. 18
3. 28
4. 32
1. Integer a, b, c
2. Set a = 1, b = 6, c = 10
3. for(each c from 2 to 5)
5. Continue
6. End if
7. a = (6&8) + c
8. b=5+a
9. End for
10. Print a + b
Note:
continue: When a continue statement is encountered inside a loop, control jumps to the beginning of the
loop, skipping the execution of statements inside the body of the loop for the current iteration.
^: bitwise exclusive OR
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Options:
1. 7
2. 8
3. 2
4. 26
1. Integer p, q, r
2. Set p = 9, q = 5, r = 4
3. for(each r from 3 to 6)
4. q=q&r
5. if(1 < q)
6. Continue
7. Else
8. p = (10 + 9) + 9
9. r = (r + 6) + p
10. End if
12. Print p + q
Note:
continue: When a continue statement is encountered inside a loop, control jumps to the beginning of the
loop, skipping the execution of statements inside the body of the loop for the current iteration.
Options:
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
1. 22
2. 20
3. 29
4. 21
2. for(each c from 2 to 6)
3. b = (1882 ^ a)
5. b = (a + c) + a
6. End if
7. End for
8. return a + b
Note:
^: bitwise exclusive OR
Options:
27
36
24
23
Q5. Provide a sample pseudocode for stack operation that uses the LIFO principle. You are taking 10 items
and displaying them in the LIFO (Last In, First Out) order.
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Options:
A.
B.
C.
D.
Q7. What will be the output of the given pseudocode for a = 9, b = 6, and c = 8?
Pseudocode:
63
51
40
44
Pseudocode:
LIST [3, 0, 4, 5, 2]
FOR i FROM 0 TO LENGTH(LIST) - 1
FOR j FROM i + 1 TO LENGTH(LIST)
IF LIST[i] > LIST[j]
TEMP = LIST[i]
LIST[i] = LIST[j]
LIST[j] = TEMP
END IF
END FOR
END FOR
PRINT LIST
What will be the output of this pseudocode? Select the correct option from the given choices:
[0, 2, 3, 4, 5]
[3, 0, 4, 5, 2]
[4, 3, 2, 0, 5]
[1, 0, 2, 3, 4]
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Pseudocode:
Set i = 10
Set j = 20
Set x1 = address of i
Set x2 = address of j
Print "First print:", *x1, *x2
Options:
Class Reactangle
Method Rectangle(length, width):
Self.length = length
Self.width = width
Method calculate_area():
Return Self.length * Self.width
My_rectangle = Rectangle(4, 5)
Area_result = My_rectangle.calculate_area()
Options:
20
9
1
45
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Pseudocode:
Note:
countVowel(string) returns the number of vowels in the string. Ex: countVowel("okay") returns
2.
isPalin(string) returns 1 if the string is a palindrome; otherwise, it returns 0. Ex:
isPalin("yyy") returns 1.
Options:
2
4
0
5
Q12. What will be the output of the following pseudocode for a = 7, b = 5, and c = 4?
Pseudocode:
25
27
26
36
Q13. What will be the output of the given pseudocode? Select the correct option from the given choices.
Pseudocode:
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Integer p, q, r
Set p = 3, q = 4, r = 9
For (each r from 4 to 5)
p = (12 + 5) + p
End for
For (each r from 2 to 5)
q = 5 + q
End for
r = r + p
Print p + q
Options:
59
63
61
69
Q14. What will the following pseudocode print? Select the appropriate answer from the given choices.
Pseudocode:
FOR i = 1 TO 3
FOR j = 1 TO i
PRINT('*')
Options:
A)
**
**
**
B)
*
**
***
C)
***
**
*
D)
*
**
***
*
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Pseudocode:
FUNCTION identifyType(value)
IF typeof(value) = 'float' THEN
RETURN "Value is a float"
ELSE IF typeof(value) = 'integer' THEN
RETURN "Value is an integer"
ELSE
RETURN "Type is unknown"
END IF
print(identifyType(12.34))
Options:
Type is unknown
Value is an integer
Value is a float
Error
Pseudocode:
Integer j
Integer arr[4] = (2, 1, 1, 3)
Options:
0
4
2
8
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Pseudocode:
FUNCTION checkDataType(value)
IF value IS INTEGER THEN
RETURN 'Integer'
ELSE IF value IS STRING THEN
RETURN 'String'
ELSE
RETURN 'Other'
END IF
END FUNCTION
result = checkDataType(5)
DISPLAY result
Options:
Integer
String
Float
Error
Pseudocode:
PROCEDURE modify_value(pointer)
*pointer = *pointer * 2
END PROCEDURE
PROCEDURE main()
x = 5
pointer_x = address of x
modify_value(pointer_x)
OUTPUT "x =", x
END PROCEDURE
Options:
5
10
20
15
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
1 Integer p,q,r
2 Set p=8, q=6, r=6
3 for(each r from 5 to 8)
4 p=(3+12)&q
5 p=(r+12)+г
6 End for
7 for(each r from 5 to 8)
8 q=q+r
9 End for
10 Print p+q
60
62
55
71
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Q. What will be the output of the depicted pseudo code for a=0, b=8, and c=6?
Note && Logical AND -The logical AND operator (&&) returns the Boolean
value true (or 1) if both operands are true and returns false (or 0) otherwise.
1 Integer p,q,r
2 Set p=0, q-2, г-10
3 p-rep
4 for(each r from 2 to 4)
5 p=3+p
6 p=(q+p)+q
7 p=p^q
8 End for
9 q=q+p
10 Print p+q
Note- is the bitwise exclusive OR operator that compares each bit of its first
operand to the corresponding bit of its second operand. If one bit is 0 and the other
bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result
bit is set to 0.
66
58
72
Q. What will be the output of the following pseudo code:
Note- & Logical AND - The logical AND operator (&&) returns the Boolean value
true (or 1) if both operands are true and returns false (or 0) otherwise. && bitwise
AND - The bitwise AND operator (&) compares each bit of the first operand to
the
corresponding bit of the second operand. If both bits are 1, the corresponding result
bit is set to 1. Otherwise, the corresponding result bit is set to 0.
3
12
1 count=1
2 result 0
3
4 WHILE count <= 5
5 result result + count
6 count count + 1
7 END WHILE
8
9 OUTPUT result
Select an option
15
20
10
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
1 DECLARE String x
2 DECLARE Integer y
3 SET x to '7'
4 SET y to 3
5 SET z to x + y
6 PRINT z
Considering the data types of the variables (x is a string and y is an integer), what
will be the output of this pseudocode il the operation is intended to concatenate?
Select the correct option from the given choices.
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Select an option
1 Integer j
2 Integer arr[4]= {2, 1, 1, 3}
3 arr[3]=5&arr[2]
4 for(each j from 4 to 5)
5 arr[j mod 4]=(arr[2]+3)+arr[0]
6 arr[j mod 4]=arr[1]&arr[2]
7 End for
8 arr[1]=arr[2]+arr[1]
9 Print arr[2]+arr[3][/code]
0
4
2
8
Select an option
Blowfish
RSA
ECDSA
AES
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Q. Consider the given codes and choose the option that is associated with these
codes.
Code 1:
Code 2:
1 function average_mark(set_of_marks)
2 ....
3 end function
1 halfterm_marks = [53,60,80]
2
3 print "The average is:"
4 print average_mark(halfterm_mark)
Select an option
Select an option
5
120
25
Error
Q. Given the following pseudocode, what will be the output after execution?
1 FUNCTION checkNumber(arr)
2 maxVal arr[0][0]
3 FOR i=0 TO LENGTH(arr) - 1
4 FOR j=0 TO LENGTH(arr[i]) - 1
5 IF arr[i][j] > maxVal
6 maxVal = arr[i][j]
7 ENDIF
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
8 ENDFOR
9 ENDFOR
10 RETURN maxVal
11 ENDFUNCTION
12
13 array = [[1, 3, 5], [7, 9, 2], [4, 6, 8]]
14 PRINT checkNumber(array)
1 FOR i= 1 TO 2
2 FOR i = 1 TO 3
3 PRINT(i, j)
4 IF j == 2
5 BREAK
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037
Select an option
7 ENDFOR
8 RETURN result
9 ENDFUNCTION
10
11 arr = ["Apple", "Banana", "Avocado", "Cherry", "Apricot"]
12 PRINT concatenateAStrings(arr)
AppleAvocadoApricot
BananaCherry
AppleApricot
Avocado Apricol