-
About The Course 0
This Course is Only Available On Our App
Dive-in and start learning! Get offline access to all the course contents!
No items in this sectionVerbal 10
-
Lecture2.1
-
Lecture2.2
-
Lecture2.3
-
Lecture2.4
-
Lecture2.5
-
Lecture2.6
-
Lecture2.7
-
Lecture2.8
-
Lecture2.9
-
Lecture2.10
Critical Reasoning 14
-
Lecture3.1
-
Lecture3.2
-
Lecture3.3
-
Lecture3.4
-
Lecture3.5
-
Lecture3.6
-
Lecture3.7
-
Lecture3.8
-
Lecture3.9
-
Lecture3.10
-
Lecture3.11
-
Lecture3.12
-
Lecture3.13
-
Lecture3.14
Abstract Reasoning 8
-
Lecture4.1
-
Lecture4.2
-
Lecture4.3
-
Lecture4.4
-
Lecture4.5
-
Lecture4.6
-
Lecture4.7
-
Lecture4.8
Technical Assesment 6
-
Lecture5.1
-
Lecture5.2
-
Lecture5.3
-
Lecture5.4
-
Lecture5.5
-
Lecture5.6
Coding 4
-
Lecture6.1
-
Lecture6.2
-
Lecture6.3
-
Lecture6.4
Previous year Question Paper With Solution 7
-
Lecture7.1
-
Lecture7.2
-
Lecture7.3
-
Lecture7.4
-
Lecture7.5
-
Lecture7.6
-
Lecture7.7
Model Question Paper With Explanation 3
-
Lecture8.1
-
Lecture8.2
-
Lecture8.3
Accenture Pseudocode
Q.1:What will be the output of the following pseudocode?
A) 15625 B) 625 C) 3125 D) 525 AnswerAnswer:C) 3125
function(5,5) will return 5 x function(5,4)
function(5,4) will return 5 x 5 x function(5,3)
function(5,3) will return 5 x 5 x 5 x function(5,2)
function(5,2) will return 5 x 5 x 5 x 5 function(5,1)
function(5,0) will return 5 x 5 x 5 x 5 x 5 = 3125
Q.2:What will be the output of the following pseudocode?
[Note-mod finds the remainder after the division of one number by another. For example, the expression “5 mod 2” leaves a quotient of 2 and a remainder of 1]A) 15 B) 7 C) 2 D) 0 AnswerAnswer:D) 0
Explanation:
There are two variables a and b declared. Value initialized for a is 15 and b is 7. Taking mod operation for a by 12(a%12) and the answer is 3 will stored in a. The next mod operation for b is 7 mod (7%4). The answer is 3 will be stored in b. The next line takes the updated value of a and mods it by 1(3%1). Then the answer becomes 0 will be stored in a. The next line takes the updated value of b mod by 1 (3%1) then the answer is 0. Finally adding all the updated values of a and b (0+0 ) and the output of Pseudocode is 0.
Q.3:What will be the output of the following pseudo code?
Integer a, b, c
Set b = 2, a = 2
c = a ^ b
Print c
[Note- ^ is the bitwise exclusive OR operator that compares each bit of its first operand to the corresponding bit of its-- other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0]
A) 6 B) 4 C) 0 D) 2 AnswerAnswer:C) 0
Explanation:
There are three variables a, b and c declared. Value initialized for a is 2 and b is 2. When we do a bitwise exclusive OR of c i.e (2^2), the answer is 0. Finally, print the value of c.
Q.4:Find the output of the following pseudo-code:
Integer x,y,z;
x=0
y=1
x = y = z = 8
Print xA) 0 B) 8 C) 1 D) None of the above AnswerAnswer:B) 8
Explanation:
In this question, the value of x is initialized as 0 and y as 1 in the beginning. Later the value 8 is assigned to the variable z and the value of z is assigned to the variable y and the value of y is assigned to the variable x. Finally, the value of x is updated as 8.
Q.5:Find the output of the following pseudo-code:A
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.A) 64 B) 32 C) 45 D) None of the above AnswerAnswer:A) 64
Explanation:
Here, the left shift operation pushes the values towards the left once; when 1 is left-shifted the value that we will be obtaining will always be 2 to the power something. When one is converted in the beginning and not shifted the value will be 2^0 which is 1. The next iteration will be pushed one place towards the left, therefore the value now will be 2^1 which is 2; this will go on happening until the value stored is greater than 45. The value which is greater than 45 in 2 powers is 64. Now the loop terminates and the last value stored in the variable is 64 and the same will be printed.
Q.6:Find the output of the following pseudo-code:
A) 14 26 38 B) 27 39 C) 15 27 39 D) None of the above AnswerAnswer:C) 15 27 39
Explanation:
c and a is initialized, and d as well; line 5 we are re-initializing c in every iteration of goto; the goto loop terminates only when the value of c is greater than 40 the last value stored in c which breaks the if the condition is 51 and all the numbers 15 27 and 39 will be printed according to the algebraic expression in line number 5.
Q.7:Find the output of the following pseudo-code if x= 4 and y=5:
A) 4 5 6 B) 7 6 5 C) 9 7 5 D) None of the above AnswerAnswer:C) 9 7 5
Explanation:
the first reverse recursion would print 9 and returns to a previous function call, next it prints 7 and returns to the very first function call finally it prints a 5 and completes the execution.
Q.8:How many times will the print statement be executed:
A) 2 B) 3 C) 1 D) 0 AnswerAnswer:B) 3
Explanation:
All the conditions are true when checked with the condition so the print statement will be executed 3 times.
Q.9:What will be the output if the following pseudocode if a=10 and b=6:
A) 2 B) 4 C) 3 D) 1 AnswerAnswer:A) 2
Explanation:
The while loop will only terminate when the value of b becomes zero, this will happen only after the 4th iteration when the last value of the b will be zero and the value of a is 2
Q.10:What will be the output of the following pseudo-code?
[Note: << is left shift operator, it takes two numbers, left shifts the bits of the first operand, the second operand decodes the number of …]
A) 1 B) 8 C) 0 D) 64 AnswerAnswer:D) 64
Explanation:
When the x is reinitialized in line 3 the value stored will be 3. Therefore 8 has to be left-shifted thrice. The shifted value is the 3rd next power of 2 that is 2^6 and the value is 64.
Q.11:What will be the output of the following pseudocode?
A) 5 B) 3 C) 2 D) 1 AnswerAnswer:D) 1
Explanation:
AND gate works when both the conditions are true so the first (x and y) condition will be taken as true as both the inputs are true. OR gate works when any of the conditions are true, where it has already got one of its input as true so without checking the other input it will directly assign the value as 1.
Q.12:What will be the output of the following pseudocode?
A) 7 14 7 B) 7 14 10 C) 7 8 14 D) 7 18 14 AnswerAnswer:D) 7 18 14
The intial values of a=5, b=4, c=3
a = 4 +3 = 7
c = 7 – 4 = 3
c = 3 + 7 = 10
c = 4 + 10 = 14
b = 4 + 14 = 18
Print 7, 18, 14Q.13:What will be the output of the following pseudocode?
A) 5 3 9 B) 6 14 17 C) 6 4 14 D) 6 4 16 AnswerAnswer:D) 6 4 16
The loop runs for 5 times; after the 5th iteration the value of a=6; b=4; c=10. So the final answers are 6, 4, 16
Q.14:What will be the output of the following pseudocode?
A) 6 6 6 B) 6 5 6 C) 5 5 5 D) 6 5 4 AnswerAnswer:D) 6 5 4
Step 1:
It will print i+3, here i value is 3. So i+3 is 6. On the next line, i will be decremented by 1. Then checking the conditions in do-while() i!=0. Here updated i value is 2 (2!=0),so condition is true. The loop continues.
Step 2:
It will print i+3, here updated i value is 2. So i+3 is 5. On the next line i will be decremented by 1. Then checking the conditions in do-while() i!=0. Here updated i value is 1 (1!=0),so condition gets true. The loop continues
Step 3:
It will print i+3, here updated i value is 1. So i+3 is 4. On the next line i will be decremented by 1. Then checking the condition in do while() i!=0. Here updated i value is 0 (0!=0),so condition gets false. Thus the loop gets terminated!Q.15:What will be the output of the following pseudo code?
Integer a
String str1
Set str1 = "goose"
a = stringLength(str1)
Print (a ^ 1)A) 0 B) 4 C) 5 D) 3 AnswerAnswer:B) 4
There are two variables a and str1. Value initialized for str1 is “goose”. On the next line, we are finding the length of str1 that is 5. Finally, printing the output of a bitwise exclusive OR operator with 1. And the answer is 4
Q.16:What will be the output of the following pseudocode for a=3, b=4, c=4?
Integer a, b, c
Set a = 8, b = 51, c = 2
c = (a ^ c)^ (a)
b = b mod 4
Print a + b + cA) 13 B) 17 C) 26 D) 16 AnswerAnswer:A) 13
There are three variables a, b and c declared. Value initialized for a is 8, b is 51 and c is 2. When we do a bitwise exclusive OR of (8^2), the answer is 10. Again 10 bitwise exclusive OR of a i.e (10 ^ 8) is 2, which will be stored in variable c. Then taking modulo operation for b by 4 (b%4) the answer is 3. Finally adding all the updated values of a,b, and c (8+2+3 ) and the output of Pseudocode is 13.
Q.17:What will be the output of the following pseudo code for a=1, b=6, c=5?
Integer a, b
Set a = 15, b = 7
a = a mod (a - 3)
b = b mod (b - 3)
a = a mod 1
b = b mod 1
Print a + bA) 15 B) 7 C) 2 D) 0 AnswerAnswer:D) 0
There are two variables a and b declared. Value initialized for a is 15 and b is 7. Taking mod operation for a by 12(a%12) and the answer is 3 will stored in a. The next mod operation for b is 7 mod (7%4). The answer is 3 will be stored in b. The next line takes the updated value of a and mods it by 1(3%1). Then the answer becomes 0 will be stored in a. Next line takes the updated value of b mod by 1 (3%1) then the answer is 0. Finally adding all the updated values of a and b (0+0 ) and the output of Pseudocode is 0.
Q.18:What will be the output of the following pseudo code for a=1, b=6, c=5?
Integer a, b, c
Set b = 5, a = 2, c = 2
if(b>a && a>c && c>b)
b = a + 1
Else
a = b + 1
End if
Print a + b + cA) 2 B) 13 C) 26 D) 5 AnswerAnswer:B) 13
There are three variables a, b and c declared. Value initialized for a is 2, b is 5 and c is 2. Checking the condition using if, b >a and a>c and c>b here if conditions get false. Now else part will be executed. b value will be incremented by 1 and stored in a. Finally adding all the updated values of a, b and c (6+5+2 ) and the output of Pseudocode is 13.
Q.19:What will be the output of the following pseudo code?
initialize char c
set c= a
print "%d",aA) 64 B) 97 C) q D) 0 AnswerAnswer:D) 0
There are two variables a and b declared. Value initialized for a is 15 and b is 7. Taking mod operation for a by 12(a%12) and the answer is 3 will stored in a. The next mod operation for b is 7 mod (7%4). The answer is 3 will be stored in b. The next line takes the updated value of a and mods it by 1(3%1). Then the answer becomes 0 will be stored in a. Next line takes the updated value of b mod by 1 (3%1) then the answer is 0. Finally adding all the updated values of a and b (0+0 ) and the output of Pseudocode is 0.
Q.20:What will be the output of the following pseudo code for arr[]= 1,2,3,4,5
initialize i,n
intialize an array of size n
accept the values for the array
for i= 0 to n
arr[i] = arr[i]+arr[i+1]
end forA) 3 5 7 9 5 B) 3 5 7 9 11 C) 3 5 9 15 20 D) error AnswerAnswer:A) 3 5 7 9 5
Pseudo Code [Practice Problem]