0% found this document useful (0 votes)
18 views78 pages

Pseudocode

Uploaded by

abishekclg20
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)
18 views78 pages

Pseudocode

Uploaded by

abishekclg20
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/ 78

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

2----

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)

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.

AppleAvocadoApricot
BananaCherry
AppleApricot
Avocado Apricol

You might also like