Accenture Pseudo Code Quiz-1a

Question 1

Time: 00:00:00
Consider the following piece of code. What will be the space required for this code?

int sum (int A[], int n)
{
int sum = 0, i;
for (i = 0; i < n; i++)
sum = sum + A[i];
return sum;
}// sizeof(int) = 2 bytes

2n + 8

2n + 8

2n + 4

2n + 4

2n + 2

2n + 2

2n

2n

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What will be the output of the following pseudo code?

For input a = 8 & b = 9.
function (input a, input b)
If (a < b)
return function (b, a)
elseif (b != 0)
return (a + function (a, b - 1))
else
return 0

56

56

88

88

72

72

65

65

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What will be the output of the following pseudo code?

Input m = 9, n = 6;
m = m + 1 ;
n = n - 1 ;
m = m + n
if (m > n)
print m
else
print n

6

6

5

5

10

10

15

15

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What will be the output of the following pseudo-code?

Input f = 6, g = 9 and set sum = 0 
Integer n
if (g > f)
for (n = f; n < g; n = n + 1)
sum = sum + n
End for loop
print sum
else
print error message

21

21

15

15

9

9

6

6

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What would be the output of the following pseudocode?

Integer i, j, k
Set k = 8
for(each i from 1 to 1)
        for(each j from the value of i to 1)
            print k+1
        end for
end for

9

9

89

89

4

4

3

3

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What will be the output of the following pseudocode for a =1, b =2?

Integer funn(Integer a, Integer b )
if(a<3 && b<4)
return funn( a +1, b + 1)
Else
Return a + b
End if   
End function funn()



[Note: &&: Logical AND operator - the logical AND operator (&&) returns the Boolean value true (true () if both are true]

7

7

8

8

-7

-7

19

19

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
What will be the output of the following pseudocode for a = 2, b = 6?

Integer funn(Integer a, Integer b)
if(a > 0
if(b > 0)
return a + b + funn(a + 1, 0) + funn(a + 2, 0) + funn(a + 3, 0
End if 
End if
return a + b 
End function funn()

21

21

17

17

20

20

8

8

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What will be the output of the following pseudocode?

Integer count
for (each count from 0 to 9)
print "#"
if (count > 6)
CONTINUE 
print count 
End for

0#1#2#3#4#5#6##

0#1#2#3#4#5#6##

#0#1#2#3#4#5#6##

#0#1#2#3#4#5#6##

#0#1#2#3#4#5##7#8#9#10

#0#1#2#3#4#5##7#8#9#10

#0#1#2#3#4#5#

#0#1#2#3#4#5#

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What does the following piece of code do?

public void func (Tree root)
{
func (root.left ());
func (root.right ());
System.out.println (root.data ());
}

Preorder traversal

Preorder traversal

Inorder traversal

Inorder traversal

Postorder traversal

Postorder traversal

Level order traversal

Level order traversal

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
How will you find the minimum element in a binary search tree?

a) public void min (Tree root)
{
while (root.left () != null)
{
root = root.left ();
}
System.out.println (root.data ());
}



b) public void min (Tree root)
{
while (root != null)
{
root = root.left ();
}
System.out.println (root.data ());
}



c) public void min (Tree root)
{
while (root.right () != null)
{
root = root.right ();
}
System.out.println (root.data ());
}



d) public void min (Tree root)
{
while (root != null)
{
root = root.right ();
}
System.out.println (root.data ());
}

a

a

b

b

c

c

d

d

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Prime Video

PrepInsta Prime Video

Complete Video for Accenture

(for Accenture)
Get Prime Video

Prime Mock

PrepInsta Prime Mock

Topic Wise Full Mock and much more

(for Accenture)
Get Prime Mock
Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects