0% found this document useful (0 votes)
64 views106 pages

Pseudocode - 2

Uploaded by

Charan Avala
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)
64 views106 pages

Pseudocode - 2

Uploaded by

Charan Avala
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
You are on page 1/ 106

SIX PHRASE – Edutech Private Limited

www.sixphrase.com | [email protected] | [email protected]


17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

PESUDOCODE

1. What value is displayed by the following pseudocode?

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

2. what does the following pseudocode print?

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

3) what is the value of result after executing the pseudocode?

FUNCTION checkNumber(num):

IF NUM MOD 2==0 THEN

RETURN TRUE

ELSE

RETURN FALSE

END IF

END FUNCTION

Result <- checkNumber(7)

a) true

b)false

c)7

d)error

ANS)b)FALSE

4) What will be the output of the given pseudocode?

String str1="abba", str2="dogs"

Print isPalin(upper(str2))+count vowel (str2+str1)


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

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

5) Given the pseudocode for a function named<code>computeFactorial</code>

FUNCTION computeFactorial(n)

IF n=0 OR n=1 THEN

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

6) what does the following pseudocode do to the array of strings?

FUNCTION concatenateStrings(arr)

result=””

FOR i=0 TO LENGTH(arr) – 1

result = result +arr[i]+” ”

ENDFOR

RETURN TRIM(result)

ENDFUNCTION

arr = [“Hello”,”world”,”!”]

PRINT concatenateStrings(arr)

Option:

a) concatenate all strings without spaces

b) concatenate all strings with spaces

c)concatenate all strings with commas

d)concatenate all strings with hyphens

ANS) b) concatenate all strings with spaces

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)

IF node IS NOT NULL

Traversal(node.left)

PRINT node.value

Traversal(node.right)

END IF

END FUNCTION

Assume the binary tree is structured

/\

26

/\ /\

1357

What will be the output of the InOrderTraversal of this tree?

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

Integer funn (Integer a, Integer b)

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.

Otherwise, the corresponding result bit is set to 0.

Select the correct option from the given choices

a)0

b) 4

c) 3

d) 12

ans)c)3

9) consider the following pseudocode for an array operation

Function modifyArray(arr as Integer Array)

n<-Length of arr

for i from 0 to n-1 do

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]

10) Consider the given pseudocode snippet:

SET A to (1, 2, 3, 4, 5)

SET B to (4, 5, 6, 7, 8]

SET C to {}

FOR EACH element in A DO

IF element NOT IN C THEN

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

FOR EACH element in B DO

IF element NOT IN C THEN

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}

11) Consider the given pseudocode:

Function recursiveFunction(n)

Initialize counter=0

If n<=0

Return 1

Else

counter=counter+recursiveFunction(n-1)

counter =counter+ recursiveFunction(n-2)


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

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

12) What will be the output of the given pseudo code?

Integer pp,qq,rr

Set pp=0, qq=6, rr=8

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

Select the correct option from the given choices

a) 34.0

b) 41.0

c) 30.0

d) 46.0

ANS) a)34.0

13) What will be the output of the given pseudo code?

Integer a,b,c

Set a=2, b=6, c=7

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

Select the correct option from the given choices

a) 33.0

b) 38.0

c) 30.0

d) 47.0

ANS)a)33.0

14) Analyze the depicted pseudocode

Enum Status {New, InProgress, Completed, Archived}

Function ProcessStatus(status: Status) ->Integer

var result: Integer

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

Case Status. Archived:

result = 0

End Switch

if (result > 0) then

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)

Case ‘+’ : result = num1+num2;

break;

case ‘-’ : result = num1-num2;

break;

//Rest of the operations

print("Result =”+ result)

//if user wants to perform addition, then

call calculatorOperation(10000, 5000, ‘+’)

//must be passed and hence output will be

15000

16) Refer to the given pseudocode

Begin

Declare color as enumerated datatype

Initialize ‘color’ as {RED, GREEN, BLUE}

SET c=Color.GREEN

case с OF

RED: print "Rose"

GREEN: print "Leaves"


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

BLUE: print "sky"

OTHERWISE print "Dark"

end case

end

(A) What will be the output of the given pseudocode?

(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

Declare Color as enumerated datatype

Initialize Color as {RED, GREEN,BLUE}

SET Array arr as Enum(Get enumerated Values))

Declare Ist1 as List of type string

For i=1 to 3

Insert item arr[i] to list. Ist1

next i

End For

End

b) Begin

Declare Color as enumerated datatype

Initialize Color as {RED, GREEN, BLUE}

SET Array arr as Enum(Get enumerated Values))

Declare Ist1 as List of type string


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

For i=1 to 3

Insert item arr[i] to list Ist1

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

2. Get the number that to be searched

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

2) get the number that to be searched

3) get the middle number of the list and check if the given number = middle number true display it is found

4) else we cannot recursively do operations as the search limit is exceeded

17) consider the following pseudocode

Set a to 5

Set b to 3

Set result to(a*(b+2)>20) AND NOT(a MOD 2==0)

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

19. Analyze the given pseudocode

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

8 SET obj as object of class BLOCK123

9 INITIALIZE object obj as x=45

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

(B) Along with the default constructor include a parametrized constructor

B (A) FUNCTION BLOCK1230

SET abc = 100

end FUNCTION

(B) Two default constructors are not allowed, only one is allowed

C (A) FUNCTION BLOCK123(int x)

SET x= 100

SET abc=x

end FUNCTION

(B) Two detault constructors are allowed,only one is allowed


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

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()

17 PRINT ‘Product’, self.name, 'Quantity:', self.quantity, 'Price:',

self.price

18 END METHOD

19 END CLASS

20

21 product = Product("Laptop', 50, 1200)

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?

Select the correct option from the givrn choices.

A Product Laptop Quantity: 35. Pracy: 1200

B Product: Laptop, Quantity: 50. Price: 1200

C Product: Laptop, New Quantity: 30, Price: 1200

D Product: Laptop, Price 1200

21. Consider the following pseudocode snipper

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

What will be the output of the <code>main</code> 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

22. What is the displayed by the following pseudocode

1 FUNCTION identifytype(value)

2 IF typeof (value)= 'float' THEN

3 RETURN 'Floating Point’

4 ELSE IF typeof (value) =’boolean’ THEN

5 RETURN ‘Boolean’

6 ELSE

7 RETURN ‘Unknown’

8 END IF

9 END FUNCTION

10

11 result= identifyType(true)

DISPLAY result

Select the appropriate answer from the given choices.

a) Floating Point

b)Boolean

c)Unknown

d)True

23. what will be the output of the following pseudocode


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

1 FUNCTION checkDatatype(value)

2 IF value IS INTEGER THEN

3 RETURN 'Integer’

4 IF value IS STRING THEN

5 RETURN 'String’

6 ELSE

7 RETURN ‘Other’

8 END IF

9 END FUNCTION

10

11 result = checkDataType(5)

12 DISPLAY result

Select the appropriate answer from the given choices

a) Integer

b)String

c)Float

d)Error

24. what will be the output of the following pseudocode

1 FUNCTION identifytype(value)

2 IF typeof (value) ='float' THEN

3 RETURN 'Floating Point’

4 ELSE IF typeof (value) ="boolean" THEN


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

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

25. What will be the output of the given pseudocode?

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

Select the correct option from the given choices.

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,г

2 Set p-3, q-4, г-9

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

27. What will be the output of the following pseudo code

1 Integer j

2 Integer arr[4]= (2, 1, 1, 3)

3 arr[3]=5&arr[2]

4 for(each 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

Select the correct option from the given choices.

a)0

b)4

c)2

d)8

28. be the output 2049at will of the given pseudo code?

1 integer j

2 Integer arr[4] (3, 3, 2, 2)

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)

5 arr[j mod 3)-(arr[0]+4)+arr[1]

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.

Select the correct option from the given choices.

a)35.0

b) 28.0

c) 7.0

d) 21.0

29. Analyze the given pseudocode

1 LIST=[13, 0, 4, 5, 2]

2 FOR I FROM O TO LENGTH (LIST) -1

3 FOR FROM 11 TO LENGTH (LIST)

4 IF LIST[1] > LIST[J]

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]

30. Consider the following pseudocode0491A4406-136357614 2

1 Class Rectangle:

2 Method Rectangle(length, width):

3 self.length length

4 Self.width= width

6 Method calculate_area():

7 Return Self.length Self.width

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?

1 Integer funn(Integer a, Integer b, Integer c)

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

Select the correct option from the given choices.

a)63

b) 51

c)40

d)44

32. Consider the following pseudocode

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

6 Print "First print:", "x1, x2

8. Swap values using pointers:

Select an option

a. "x1"x1 + x2

10

b. "x2"x1"x2

7814/23

c. "x1"x1 x2

12

33. Print "Second print:", "x1, x2

What will be the output of the pseudocode?

a) First print: 1020, Second print: 2010

b) First print: 2010, Second print: 10 20

c) First print: 10 20, Second print: 10 20


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

d) First print: 20 10, Second print: 20 10

34. What will be the output of the following pseudo code for a 7, b=5, c=47

1 Integer funn(Integer a, Integer b, Integer c)

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

11 PRINT fun (10)

Select an option

30

25

40

15

36. What will the following pseudocode print?

1 str = ‘123abc’

2 pattern =’\d+’
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

3 match = regex_match(pattern, str) print(match)

4 print(match)

Select the appropriate answer from the given choices.

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()

13 PRINT 'Title:', self.title

14 PRINT 'Author:', self.author

15 PRINT 'Pages:', self.pages

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

19 Book ('1984', 'George Orwell', 328)

20 b.DisplayInfo()

What will be the output when the DisplayInfo method is executed? Select the correct option from the

Title: 1984, Author: George Orwell, Pages: 328

1984 by George Orwell, 328 pages

Book information 1984, George Orwell, 328

1984, George Orwell, 328

38. What will be the output of the given pseudocode?

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"

Select the correct option from the given choices.

39. What will be the output of the following pseudo code?


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

1 Integer a,b,c

2 set a-2, b-7, c-4

3 for(each c from 5 to 6)

4 a(c^9)*c

5 A=12&a

6 End for

7 Print a+b

Select the correct option from the given choices

12

15

19

33

40. Analyze the given pseudocode

1 CLASS BLOCK123

2 int abc;

3 FUNCTION BLOCK123(int x)

4 SET abc-x

5 end FUNCTION

6 end class

7 BEGIN

8 SET obj as object of class BLOCK123


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

9 INITIALIZE object obj as xx45

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

(B) Along with the default constructor indude a parametrized constructior

(A) FUNCTION BLOCK1230

SET abc = 100

end FUNCTION

(B) Two default constructors are not allowed, only one is allowed

(A) FUNCTION BLOCK123(int x)

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

(B) Two default constructors are allowed

41. Analyze the given pseudocode:

1 CLASS BLOCK123

2 int abc;

3 FUNCTION BLOCK123(int x)

4 A SET abc-x

5 end FUNCTION

6 end class

7 BEGIN

8 SET obj as object of class BLOCK123

9 INITIALIZE object obj as x=45

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

(A) FUNCTION BLOCK1230

SET abc = 100

end FUNCTION

(B) Two default constructors are not allowed, only one is allowed

(A) FUNCTION BLOCK123(int x)

SET x=100

SET abc=x

end FUNCTION

(B) Two default constructors are allowed

(A) FUNCTION BLOCK123(100)

SET abc =100

end FUNCTION

(B) Always include the prefix 'cons' for defining the second default constructor

42. Analyze the given pseudocode for combining three sets:

1 SET A =(10, 20, 30)

2 SET B= (20, 30, 40)

3 SET C= (30, 40, 50)

4 SET D= EMPTY SET

5 FOR EACH element IN A

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

8 FOR EACH element IN a

9 IF element NOT IN D

10 ADD element TO D

11 END IF

12 END FOR

13 FOR EACH element IN C

14 IF element NOT IN D

15 ADD element TO D

16 END IF

17 END FOR

38 LIST D_SORTED = SORT(D)

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:

1 function average_mark( set_of_marks)


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

3 end function

1 halfterm_marks= [53,60,80]

3 print "The average is:"

4 print average_mark(halfterm_mark)

Formal Parameter-set_of_marks

Actual Parameter-hallterm_mark

Formal Parameter-halfterm_mark

Actual Parameter -set_of_marks

Formal Parameter-average_marks

Actual Parameter-halfterm_marks

Formal Parameter-halfterm_marks

Actual Parameter-average_marks

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

1. Integer p, q, r

2. Set p=5, q=8, r=6

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

11. End for

12. Print p+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. 18
2. 14
3. 25

2. What will be the output of the following pseudocode?

1. Integer p, q, r

2. Set p=5, q=3, r=10

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.

12. Jump out of the loop

13.

14. End if

15.

16. q=(p+q)&q

17. End for

18. Print p+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

3. What will be the output of the following pseudo code?

Integer a, b, c

Set a=1, b=5, c=7

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

4. What will be the output of the following pseudo code?

Integer a, b, c

Set a=2, b=4, c=5

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

Set p=7, q=3, r=10

q=(2+4)+r

if((p+q)<(r+p) && 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

6. What will be the output of the following pseudo code?

Integer pp, qq, rr

Set pp=4, qq=2, rr=10

rr=(rr+12)+qq

if((pp+qq)>(qq+pp))

pp=rr^pp

End if

rr=qq+qq

if((rr+6)>(qq-rr) && rr<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

7. What will be the output of the following pseudo code?

Integer a, b, c

Set a=3, b=7, c=6

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

8. What will be the output of the following pseudo code?


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

1. Integer a, b, c

2. Set a = 7, b = 5, c = 9

3. for (each c from 4 to 7)

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

9. What will be the output of the following pseudo code for a = 9, b = 8?

1. Integer funn(Integer a, Integer b)

2. if(b < a && b > 7)

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?

1. Integer funn(Integer a, Integer b)

2. if(a < 6 && ((2 - b) < (b - a)))

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?

1. Integer funn(Integer a, Integer b)

2. if((a & b) < (b - a) && (3 + a) > (a ^ b))

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

12. What will be the output of the following pseudocode for a = 4, b = 6, c = 7?

1. Integer funn(Integer a, Integer b, Integer c)

2. for(each c from 2 to 5)

3. a = (c + a) + c

4. if((c + b +a) > (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

13 What will be the output of the following pseudocode for a = 5, b = 8, c = 77?

1. Integer funn(Integer a, Integer b, Integer c)

2. if((c + a + b) < (a + b + c))


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

3. a = (3 + 6) + a

4. if((b + a + 10) < (7 + c + b))

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

14 What will be the output of the following pseudocode?

1. Integer p, q, r

2. Set p = 3, q = 4, r = 4

3. for(each r from 3 to 7)

4. if((p + r + q) > (q - p))

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 AND

^: bitwise XOR

Options

1. 2
2. 15
3. 7
4. 11

15 What will be the output of the following pseudocode?

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)

5. Jump out of the loop

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

16 What will be the output of the following pseudocode?

1. Integer a, b, c

2. Set a = 1, b = 6, c = 10

3. for(each c from 2 to 5)

4. if((c ^ a) < (b + c))

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 AND

^: 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

17 What will be the output of the following pseudocode?

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

11. End for

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.

&: bitwise AND

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

18 What will be the output of the following pseudo code for a = 6, b = 3, c = 6?

1. Integer funn(Integer a, Integer b, Integer c)

2. for(each c from 2 to 6)

3. b = (1882 ^ a)

4. if((a - b - c) < (c - 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.

1 ArrayList nameList = new ArrayList();


2 // Get names one by one and add in loop
3 nameCount = 10;
4 for (int i = 0; i < nameCount; i++) {
5 // Get name and add in nameList
6 }
7 // Display in LIFO order
8 for (int i = 0; i < nameList.length(); i++) {
9 System.out.println(nameList.get(i).toString());
10 }

B.

1 ArrayList nameList = new ArrayList();


2 // Get names one by one and add in loop
3 nameCount = 10;
4 for (int i = 0; i < nameCount; i++) {
5 // Get name and add in nameList
6 }

C.

1 ArrayList nameList = new ArrayList();


2 // Get names one by one and add in loop
3 nameCount = 10;
4 for (int i = 0; i < nameCount; i++) {
5 // Get name and add in nameList
6 }
7 // Display in LIFO order
8 for (int i = nameList.length(); i > 8; i--) {
9 System.out.println(nameList.get(i).toString());
10 }

D.

1 ArrayList nameList = new ArrayList();


2 // Get names one by one and add in loop
3 nameCount = 10;
4 for (int i = 0; i < nameCount; i--) {
5 // Get name and add in nameList
6 }
7 // Display in LIFO order
8 for (int i = nameList.length(); i > theta; i--) {
9 System.out.println(nameList.get(i).toString());
10 }

Q6. Write the pseudocode for the given details.


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

A. Create a class that initializes length and breadth.

B. Create a derived class that calculates the perimeter of the rectangle.

Q7. What will be the output of the given pseudocode for a = 9, b = 6, and c = 8?

Pseudocode:

Integer funn (Integer a, Integer b, Integer c)


a = (a + a) + c
for (each c from 3 to 6)
b = 6 + c
a = (4 + 4) + b
b = (c + b) + c
End for
return a + b

Select the correct option from the given choices:

• 63
• 51
• 40
• 44

Q8. Analyze the given pseudocode:

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

Q9. Consider the following pseudocode:

Pseudocode:

Set i = 10
Set j = 20
Set x1 = address of i
Set x2 = address of j
Print "First print:", *x1, *x2

Swap values using pointers:


a. *x1 = *x1 + *x2
b. *x2 = *x1 - *x2
c. *x1 = *x1 - *x2

Print "Second print:", *x1, *x2

Options:

• First print 10 20, second print 20 10


• First print 20 10, second print 10 20
• First print 10 20, second print 10 20
• First print 20 10, second print 20 10

Q10. Consider the following pseudocode:

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

Q11. What will be the output of the given pseudocode?

Pseudocode:

String str1 = "hide", str2 = "race"


Print isPalin(lower(str2) + str1) + countVowel(str1)

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:

Integer funn (Integer a, Integer b, Integer c)


For (each c from 4 to 5)
b = (5 + 10) + c
End for
For (each c from 5 to 6)
b = 12 + a
End for
Return a + b

Select the correct option from the given choices:

• 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

Q15. What value is displayed by the following pseudocode?

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

Q16. What will be the output of the following pseudocode?

Pseudocode:

Integer j
Integer arr[4] = (2, 1, 1, 3)

arr[3] = 5 & arr[2]

FOR (each j FROM 4 TO 5)


arr[j MOD 4] = (arr[2] + 3) + arr[0]
arr[j MOD 4] = arr[1] & arr[2]
END FOR

arr[1] = arr[2] + arr[1]

PRINT arr[2] + arr[3]

Options:

• 0
• 4
• 2
• 8
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

Q17. What will be the output of the following pseudocode?

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

Q18. Consider the following pseudocode snippet.

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

What will be the output of the main procedure?

Options:

• 5
• 10
• 20
• 15
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 following pseudo code?

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

Select the correct option from the given choices.

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?

1 Integer funn (Integer a, Integer b, Integer c)


2 if((b+a)<a && (b+a)<a)
3 if((a+5+5)>(C+6))
4 c=a+b
5 End if
6 End if
7 a=(11+9)+c
8 return a+b+c

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.

Select the correct option from the given choices.


37
40
42
49
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?

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.

Select the correct option from the given choices.


60
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

66
58
72
Q. What will be the output of the following pseudo code:

1 String str1="exit", str2="lace"


2 Print countConso (reverse(str1)+str2)+isPalin(str2)

Select the correct option from the given choices.


4
6
2
8
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 = 3 b = 4

1 Integer funn (Integer a, Integer b)


2 if( (b - a) > (a8h) && b<5)
3 a = (a + 3) + a
4a=a+2
5 return funn(b,b)+funn (b + 2, b + 1)
6 End if
7 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. Otherwise, the corresponding result bit is set to 0.

Select the correct option from the given choices.


0
4
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

3
12

Q. Consider the below pseudocode involving a "WHILE" loop.

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

Q. Refer to the given pseudocode that demonstrates the application of different


data types

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

Compilation error due to type mismatch


10
73
Undefined behavior

Q. What will be the output of the following pseudo code?

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]

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

0
4
2
8

Q. Assume that a software development team is integrating an authentication


system where data integrity and non-repudiation are critical. Which cryptographic
tool should the team use to ensure that the data sent over their network is
unchanged and verifiable? Select the correct option from the given choices.

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

Formal Parameter - set_of_marks


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

Actual Parameter - halfterm_mark

Formal Parameter - halfterm_mark


Actual Parameter-set_of marks

Formal Parameter - average_marks


Actual Parameter - halfterm_marks

Formal Parameter - halfterm marks


Actual Parameter - average_marks

Q. Given the pseudocode for a function named <code>computeFactorial</code>:

1 FUNCTION computeFactorial (n):


2 IF NOOR n 1 THEN
3 RETURN 1
4 ELSE
5 RETURN n computeFactorial (n 1)
6 ENDIF
7 END FUNCTION
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

What is the output when the function <code>computeFactorial</code> is called


with the argument <code>5</code>?

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)

Analyze the given choices and select the correct answer.


1
9
8
5
Q. What does the following pseudocode print?

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 the appropriate answer from the given choices.

Select an option

(1,1) (1,2) (1,3) (2,1) (2,2) (2,3)


(1,1) (1,2) (2,1) (2,2)
(1,2) (2,2)
(1,1) (1,3) (2,1) (2,3)
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 following pseudocode?

1 FUNCTION concatenate/Strings (arr)


2 result
3 FOR 10 TO LENGTH(arr) - 1
4 IF arr[i][0] = 'A'
5 result = result + arr[i]
6 ENDIF
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

7 ENDFOR
8 RETURN result
9 ENDFUNCTION
10
11 arr = ["Apple", "Banana", "Avocado", "Cherry", "Apricot"]
12 PRINT concatenateAStrings(arr)

Select the appropriate answer from the given choices.

AppleAv
ocadoAp
ricot
BananaC
herry
AppleAp
ricot
Avocado
Apricol
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

CODING

1. What will be the output of the given pseudo code?

Integer p, q, r

Set p = 8, q = 2, r = 6

for(each r from 3 to 5)

p = (r^10)^p

End for

p = (p&12) + q

Print p + q.

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 exclusive OR - The bitwise exclusive OR 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.

Select the correct option from the given choices:

• 16.0
• 13.0
• -3.0
• 4.0
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

2 . Analyze the following pseudocode. What will be the output after its
execution?

FUNCTION fun(n)
sum = 0
FOR i = 1 TO n
IF i % 2 == 0
sum = sum + i
ENDIF
ENDFOR
RETURN sum
ENDFUNCTION

PRINT fun(10)

Select the appropriate answer from the given choices:

1) 30
2) 25
3) 40
4) 15

3 . What does the following pseudocode do to the array of strings?

FUNCTION concatenateStrings(arr)
result = ""
FOR i = 1 TO LENGTH(arr) - 1
result = result + arr[i] + " "
ENDFOR
RETURN TRIM(result)
ENDFUNCTION

arr = ["Hello", "world", "!"]


PRINT concatenateStrings(arr)

Select the appropriate answer from the given choices:

• Concatenates all strings without spaces


• Concatenates all strings with commas
• Concatenates all strings with spaces
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

• Concatenates all strings with hyphens

4. What will be the output of the given pseudocode?

String str1 = "tide", str2 = "ookk"

Print countConso(str2 + str1) + isPalin(str1 + reverse(str2))

Note:

• countConso(string) returns the number of consonants in the string. Ex-


countConso("okay") returns 2.
• isPalin(string) returns 1 if the string is a palindrome, otherwise returns 0.
Ex- isPalin("yyy") returns 1.
• reverse(string) reverses the string. Ex- reverse("okaY") returns "Yako".

Select the correct option from the given choices:

• 3
• 4
• 5
• 6

5 . onsider the below code:

Function square(n)
if n > 0
return n * n
else
return 0
end if
End Function

Begin
int value = 3
result = square(value)
print "Square:", result
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

End

For the given pseudocode with value = 3, what will be the output of the square
function?

Select an option:

• 3
• 6
• 9
• 12

6 . What will the following pseudocode output if input a is 2 and b is 3?

FUNCTION multiplyAndAdd(a, b)
result = (a * b) + (a + b)
RETURN result
END FUNCTION

finalResult = multiplyAndAdd(2, 3)
DISPLAY finalResult

Select the appropriate answer from the given choices:

• 12
• 11
• 14
• 15

7 . What will be the output of the depicted pseudo code?

1. Integer a, b, c
2. Set a = 5, b = 7, c = 5
3. b = (1 ^ 4) + b
4. If ((c & 8) == b)
5. c=a+a
6. End if
7. Print a + b + c
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

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 exclusive OR - The bitwise exclusive OR 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.

Select the correct option from the given choices:

• 37
• 29
• 11
• 27

8 . Analyze the given pseudocode:

LIST = [3, 1, 5, 4, 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, 1, 2, 3, 4]
• [3, 0, 4, 5, 2]
• [1, 3, 4, 5, 2]
• [0, 2, 3, 4, 5]
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

9 . What will be the output of the following pseudo code?

1. Integer a, b, c
2. Set a = 2, b = 7, c = 4
3. for(each c from 5 to 6)
4. a = (c ^ 9) ^ c
5. a = 12 & a
6. End for
7. Print a + b

Select the correct option from the given choices:

• 12
• 15
• 19
• 33

10 . What will be the output of the following pseudo code:

1. String str1 = "exit", str2 = "lace"


2. Print countConso(reverse(str1) + str2) + isPalin(str2)

Select the correct option from the given choices:

• 4
• 6
• 2
• 8

11 . Consider the given pseudocode:

Function recursiveFunction(n)
Initialize counter = 0
if n == 0
Return 1
Else
counter = counter + recursiveFunction(n-1)
if counter > 1
counter = counter + recursiveFunction(n-2)
endif
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

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 from the given choices.

• 12
• 7
• 8
• 11

12 . What will be the output of the depicted pseudo code?

1. Integer p, q, r
2. Set p = 3, q = 5, r = 4
3. for(each r from 4 to 7)
4. p=6&r
5. p = (p + 2) + q
6. q = 12 + r
7. p = (q + q) + r
8. End for
9. Print p + q

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.

Select the correct option from the given choices:

• 60
• 64
• 69
• 77
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

13 . Consider an array with values: array = [1, 2, 3, 4, 5]

You need to reverse the array to get the output as [5, 4, 3, 2, 1].

1. What will be the value for the start_index and end_index to initialize in
the given code snippet?
2. What happens if the value of the array [end_index] temp is updated to
array[start_index] = temp?

Function reverse(array)
length = length(array)
initialize start_index
initialize end_index = length - 1
while start_index < end_index:
temp = array[start_index]
array[start_index] = array[end_index]
array[end_index] = temp
start_index = start_index + 1
end_index = end_index - 1

end function
print array

Select the option with the correct set of answers from the given choices.

Options:

1. initialize start_index = 1 initialize end_index = length - 1 The output will


remain the same as the original array [1, 2, 3, 4, 5].
2. initialize start_index = 0 initialize end_index = length - 1 The output will
remain the same as the original array [1, 2, 3, 4, 5].
3. initialize start_index = length - 1 initialize end_index = length The output
will be [5, 4, 3, 2, 1].
4. initialize start_index = length initialize end_index = length - 1 The output
will be [5, 4, 3, 2, 1].

13 . Assume that a developer is tasked with configuring a high-security Wi-Fi


environment for a sensitive government project using Android devices.
He/she must implement a solution that leverages both WPA3-Enterprise
security and
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

the highest available encryption settings to ensure compliance with


stringent security requirements.

Refer to the given code snippet used to configure wpa_supplicant:

CONFIG SAE=Y
CONFIG SUITEB=Y
CONFIG SUITEB192-Y

In the given scenario, which is the incorrect configuration line that might
potentially weaken the desired security level? Select the correct option from the
given choices.

Options:

• CONFIG SAE=Y is unnecessary since WPA3-Enterprise does not require


SAE
• CONFIG SUITEB=Y is required to enable basic Suite B cryptography
• CONFIG SUITEB192-Y enables the highest level of security, Suite B at
192-bit
• CONFIG SUITEB=Y is redundant when CONFIG SUITEB192-Y is also
specified

15 . What is the purpose of the below pseudocode?

1 Static Integer m1(Input Integer array[], input si, input ei)


2 Integer sml = Max value of an Integer
3 Integer min
4 For (Integer i; i less than e, increment i by 1)
5 If(sml greater than array[i])
6 sml = array[i]
7 min = i
8 End If
9 End For
10 return min
11 End
12 Static function neof(Input Integer array[], input si, input ei)
13 If(si greater than or equal to ei)
14 return
15 End if
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

16 Integer mind, temp


17 mind = m1(array, si, ei)
18 swap the value of arr[si] and arr[mind]
19 neof(array, si+1, ei)
20 End neof

Choose the correct option:

• Recursive implementation of Binary Sort


• Recursive implementation of Insertion Sort
• Recursive implementation of Bubble Sort
• Recursive implementation of Selection Sort

16. Canopy Area

You are developing a feature for an environmental awareness app that helps
users to know how much area their tree's shadow covers. You have the distance
D from a tree's trunk to the edge of the shadow. Your task is to calculate and
return an integer value representing the shadow area of the canopy.

Note: Round off the result to the nearest integer.

Input Specification:

• input1: An integer value D, representing the distance from the tree trunks
to the edge of shadow.

Output Specification:

• Return an integer value representing the shadow area of the canopy.

Example 1:

• Input: 5
• Output: 78

17 . Assume that the following code snippet is used to encrypt and decrypt
messages. Identify the incorrect statement about the functioning and security of
this implementation:

1. Encrypt the message using public key


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

2. ciphertext = public_key.encrypt(message,
padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()),
algorithm=hashes.SHA256()))
3. Decrypt the message using private key
4. plaintext = private_key.decrypt(ciphertext,
padding.OAEP(mgf=padding.MGF1(algorithm=hashes.SHA256()),
algorithm=hashes.SHA256()))

Options:

• The private key is kept secret and used for decryption and signing,
ensuring only the intended recipient can decrypt the ciphertext.
• The public key is used to encrypt messages and verify signatures,
allowing secure communication without prior key exchange.
• The use of RSA with OAEP padding and SHA-256 ensures the encrypted
message is secure against known cryptographic attacks.
• The private key serialization and encryption ensure that the public key
cannot be compromised during storage or transmission.

18 . Vowel Permutation

You are given a string S and your task is to find and return the count of
permutations formed by fixing the positions of the vowels present in the string.

Note:

• Ensure the result is non-negative.


• If there are no consonants then return 0.

Input Specification:

• input1: A string S

Output Specification:

• Return an integer value representing the count of permutations formed by


fixing the positions of the vowels present in the string.

Example 1:

• Input: ABC
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

• Output: 2

Explanation:

Here, in the given string "ABC" there is 1 vowel (A) and by fixing its position
there are 2 permutable letters (B, C). So, its permutation is 2! = 2. Therefore, 2
is returned as the output.

Example 2:

• Input: CDF
• Output: 6

Explanation:

Here, in the given string "CDF" there is no vowel and there are 3 permutable
letters (C, D, F). So, its permutation is 3! = 6. Therefore, 6 is returned as the
output.

19 . What will be the output of the following pseudocode for arr[] = 1, 2, 3, 4, 5:

Initialize i = 1
Set arr[] = 1, 2, 3, 4, 5
for i = 0 to n - 2
arr[i] = arr[i] + arr[i+1]
End for

print the array of elements

Options:

• 33495
• 43762
• 35795
• 12345

20 . Which of the following is the default return value of functions in C++?


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

Options:

• char
• int
• void
• float

21 . Which pseudocode construct is used to make a decision between two or


more alternatives?

Options:

• Loop
• Function
• Call
• Conditional statement

22 . he continue statement cannot be used with:

Options:

• for
• while
• do-while
• switch

23 . The concatenation of 2 lists can be performed in O(1) time. Which of the


following implementation of list should be used?

Options:

• Singly Linked List


• Doubly Linked List
• Circular Linked List
• Array Implementation Of Linked Lis

24 . In pseudocode, what is the purpose of the "return" statement in a function?


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

Options:

• It defines the start of the function


• It specifies the parameters of the function
• It indicates the end of the function
• It provides the result or value to be returned from the function

25 . Which of the following operator takes only integer operands?

Options:

• /
• %
• +
• *

26. Where does the execution of the program start?

Options:

• user defined function


• main function
• void function
• else function

27 . goto can be used to jump from main to within a function?

Options:

• true
• false
• May Be
• Can't Say
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

28 . The code for C:

#include <stdio.h>

int main() {
int i = 0;

while (i < 3) {
printf("I'm in while loop\n");
i++;
}

return 0;
}
Use code with caution.

How many times "i" value is checked?

Options:

• 4
• 3
• 2
• 1

29 . What will be the value of y if x = 8, y = 7, x = 9, y = 4, (0, 0)

Options:

• 0
• 6
• 9
• Compile error

30 . An operator returns true if all the sub-conditions are true.


SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

Options:

• AND
• OR
• NOT
• NAND

31 . What will be the output of the following C++ code?

#include <iostream>

using namespace std;

void fun(int x, int y) {


x = 20; y = 10;
}

int main() {
int x = 10;
fun(x, x);

cout
<< x;
}
Use code with caution.

Options:

• 10
• 20
• Compile time error
• None of the above
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

1. Assume that in a pseudocode scenario for a class named “Book”, what is the
correct syntax for creating a constructor that initializes the attributes “title” and
“author” with specific values? Select the correct answer from the given options.

Options:

A. Constructor Book(title, author):


this.title = title
this.author = author
End Constructor
B. Method Book(title, author):
this.title = title
this.author = author
End Method
C. Constructor Book:
this.title = title
this.author = author
End Constructor

D. Constructor Book(title, author):


title = title
author = author
End Constructor

2 . Consider the following pseudocode for a hash function:


1 hashFunc(keyvalue, tableSize):
2 hashValue = keyvalue % tableSize
3 return hashValue
What does this pseudocode represent?
Options:
• A sorting algorithm

• A hash function calculating the sum of each key


• A hash function mapping a key to an index in a hash table
• Pseudocode for a linked list

3. Write pseudocode to declare an array named ages and initialize it with the values
25, 20, 22, 28, and 35. Then, print the second element of the array.
Options:
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

A. 1 ARRAY ages[5] = [25, 20, 22, 28, 35]


2 PRINT ages[1]
B. ARRAY ages[5] = [25, 20, 22, 28, 35]
PRINT ages[3]
C. ARRAY ages[5]
ages[1] = 25

ages[2] = 20

ages[3] = 22

ages[4] = 28

ages[5] = 35
PRINT ages[2]

4. Find Dividend
You are given an array A, having some dividends. Further, you are given 3 numbers D,
Q, and R. A dividend can be found using a rule that states:
• Dividend = Divisor × Quotient + Remainder

Your task is to find and return an integer value representing the index of the dividend
if present in the array. If the dividend is not found, return -1.
Input Specification:
• input1: An integer array A, containing dividends

• input2: An integer D, representing divisor


• input3: An integer Q, representing quotient
• input4: An integer R, representing remainder
• input5: An integer N, representing the length of the array
Output Specification:
Return an integer value representing the index of the dividend if present in the array.
If the dividend is not found, return -1.

5. Consider the following pseudocode:


1 GET A, B, C
2 IF A > B AND A > C THEN
3 SET Result = A
4 ELSE
5 IF B > A AND B > C THEN
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

6 SET Result = B
7 ELSE
8 SET Result = C
9 END IF
10 END IF
11 Print "The result is", Result
If the user inputs the values 7 (code1), 15 (code2), and 10 (code3), what will be the
output of the program?
Options:
• The result is 7

• The result is 15
• The result is 10
• The result is 0
6. Consider the following pseudocode snippet:

1 SET a = 5
2 SET b = 3
3 SET c = a - b
What will be the value of c after executing this pseudocode?
Options:

• 2
• 8
• Error: Incompatible data types
• Error: Undefined variable a

7. Which of the given options can be valid so that it could possibly print the output
"Valid" in the following pseudocode?

1 function validcheck(string s):


2 if s matches "[a-zA-Z0-9]{6}":
3 then print "Valid"
4 else
5 then print "Not valid"
6 end if
7 end function validcheck

Options
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

A. arun32
B. kkvarun32
C. arun$2
D. arun@2

8. Consider that a multinational company with offices in different countries needs to


securely connect regional offices over the internet to ensure confidential data
transfer and communication. In the given scenario, what does implementing a site-
to-site VPN primarily address? Select the correct answer from the given choices.
Options:
• Efficient bandwidth allocation

• Anonymous internet browsing


• Secure communication between regional offices
• Protection against external viruses

9. Consider that a software developer needs to work on projects that require


different operating systems. They want a solution that allows them to seamlessly
switch between their local environment and a virtual environment running a different
operating system. Which type of virtualization would be most suitable? Select the
correct answer from the given choices.
Options:
• Virtual Desktop Infrastructure (VDI)

• Local Desktop Virtualization


• Server-based Application Virtualization
• Local application virtualization
10. Consider that in an effort to enhance resource efficiency, a company's IT
department is exploring virtualization options for their server infrastructure. To
achieve better resource utilization, which virtualization technology allows the
creation of multiple isolated instances of operating systems on a single physical
server? Select the correct answer from the given choices.
Options:
• Hypervisor

• Container
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

• Virtual network
• Virtual machine

11. Assume that you manage a business website that has faced unexpected
downtimes affecting user satisfaction. To address this issue, your employer is
considering implementing a website monitoring service. What is the primary goal of
implementing this service? Select the correct answer from the given choices.
Options:
• Enhance website design and functionality

• Optimize server load during peak traffic


• Ensure regular maintenance of the website
• Proactively detect and address unexpected downtimes

12. Consider that in a cloud computing environment, which security measure helps
protect user accounts by requiring them to provide two different types of
identification before granting access? Select the correct answer from the given
choices.
Options:
• Firewalls

• Encryption
• Multi-factor authentication
• Antivirus software
13 . What type of rootkit intercepts hardware calls made by a target operating system
hosted as a virtual machine?
Options:
• Hypervisor Rootkit

• Kernel Rootkit
• Application Level Rootkits
• Bootkit
14. Consider that if a Cipher Block Chaining (CBC) encrypted message has a
corrupted block during transmission, what happens during decryption?
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

Options:
• Only the corrupted block is affected.

• All subsequent blocks become undecipherable.


• The corrupted block can be recovered during decryption.
• The entire message becomes undecipherable.
15. Consider that while testing a code for a web application, a potential data
exposure vulnerability is discovered during testing. What is the appropriate response
when given data in an exposure vulnerability? Select the correct answer from the
given choices.
Options:
• Fix

• Ignore.
• Share.
• Disable.
16. In an Excel cell, if a cell containing the date "24/01/2016" is formatted using the
format string "dd/mm/yyyy", what will be the correct output?
Options:
• 24/January/ 2016Sun

• 24/01/16 Sun
• 24/01/16 Sunday
• 24 /Jan/16 Sunday
17. While applying conditional formatting in Excel, we can check the condition
against:
• Formula

• Cell Value
• Table
Options:
• Only 1

• Only 2
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

• Both 1 and 2
• Both 2 and 3
18. A user has created a pie chart in an MS Word document and wishes to change the
chart type to a bar chart and edit the data. Which tab should be used for this
purpose?
Options:
• The user has to use the Format tab.

• The user has to use the Design tab.


• The user has to use the References tab.
• The user has to use the Layout tab.
19. Assume that Alice wants to send a confidential message to Bob over an insecure
network using public key cryptography. Explain how does Alice securely send a
confidential message to Bob using public key cryptography? Select the correct
answer from the given choices.
Options:
• Alice uses Bob's private key to encrypt the message and sends it to Bob.
• Alice uses her private key to encrypt the message and sends it to Bob.
• Alice uses Bob's public key to encrypt the message and sends it to Bob.
• Alice uses her public key to encrypt the message and sends it to Bob.
20. You are tasked with creating a professional presentation for a sales pitch. As part
of the presentation, you need to include a video clip that demonstrates the product
features. However, you notice that the video file is too large, and you want to
optimize it without compromising the quality. Which of the given options in
PowerPoint should you use?
Options:
• Compress Media

• Reduce File Size


• Resize Video
• Image Compress
21. You are working on a research paper that requires extensive citation and
referencing. You want to add footnotes to your document using Microsoft Word.
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

Which of the given options in Microsoft Word allows you to insert footnotes in your
document?
Options:
• Insert > Text > Footnote

• Page Layout > Footnotes


• References > Insert Footnote
• View > Reading View

22. Which of the given functions will round off the numbers to their nearest integers
when it is first entered in cell B2 and then dragged/copied from B2 to B4?
No A B
1 3.465 3
2 10.263 10
3 7.1622 7

Options:
• A. ROUNDUP()

• B. ROUNDDOWN()
• C. ROUNDDOWNNO
• D. Both (A) and (C)

23. In a PowerPoint presentation, a user wants to create a table that has two
columns: "S No." and "Company" as shown in the given image. Which of the following
options is the first step when creating the table?

S.no Company
1
2 alphabet
3 IBM
4 GOOGLE
5 FACEBOOK
6 APPLE
7 LINKEDIN
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

8 Zoom
9 Microsoft
10 Amazon
11 Samsung

Options:
• Insert > Table > Select 11 rows and 2 columns

• Insert > Table > Insert Table Number of columns as 2 and number of rows as 11
• Insert > Table > Select the inset 11 rows and 7 columns
• Insert > Table > Insert Table Number of columns as 2 and number of rows as 11 - 2

24.In the context of globalization and operation with distributed teams worldwide,
which information technology is essential for enabling real-time business
intelligence insights and streamlining global operations? This is crucial for making
timely decisions and aligning strategies across distributed teams.
Options:
• Computer Aided Manufacturing

• Centralized Database Management Systems


• Multimedia Systems
• Graphic Design Systems
25. What would be the output of the given code if the input value of N is 4?
Code:
1 READ N
2 SET a = 0
3 SET b = 1
4 SET c = 1
5 REPEAT
6 a = a + (b / c)
7 b=b*c
8 c=c+1
9 UNTIL c <= N
10 Print a
Options
A. 10
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

B. 4
C. 48
D. 24
26. Consider the following pseudocode:
1 Set i = 10
2 Set j = 20
3 Set x1 = address of i
4 Set x2 = address of j
5 print "First print:", *x1, *x2
6 Swap values using pointers:
7 a. *x1 = *x1 + *x2
8 b. *x2 = *x1 - *x2
9 c. *x1 = *x1 - *x2
10 Print "Second print:", *x1, *x2
What will be the output of the pseudocode?
Options:
• First print: 10 20, Second print: 20 10

• First print: 20 10, Second print: 10 20


• First print: 10 20, Second print: 10 20
• First print: 20 10, Second print: 20 10

27. Consider the following pseudocode snippet:


1 SET a = 5
2 SET b = 3
3 SET c = a - b
What will be the value of c after executing this pseudocode?
Options:
Options:
• “8”

• 8
• Error: Incompatible data types
• Error: Undefined variable 'a'
SIX PHRASE – Edutech Private Limited
www.sixphrase.com | [email protected] | [email protected]
17, GKD Nagar, Pappanaickenpalayam, Coimbatore-641037

28. In the following pseudocode:

1 SET count = 0
2 WHILE count <= 5
3 PRINT "Hello"
4 count = count + 1
5 ENDWHILE
How many times will the "Hello" be printed?
Options:
• 3
• 4
• 5
• 6

29. In the following pseudocode:

1 Function doubleNumber(x)
2 result = x * 2
3 return result
4 End Function

5 Declare variable num


6 Set num to 3
7 Print "After doubling, the result is", call function doubleNumber(num)
What is the purpose of the code result variable?

You might also like