Question 1

Time: 00:00:00
Function main()
{
Integer i=0.7
Static float m=0.7
If(m equals i)
Print(“We are equal”)
Else If(m>i)
Print(“I am greater”)
Else
Print(“I am lesser”)

We are equal

We are equal

I am greater

I am greater

I am lesser

I am lesser

This code will generate an error

This code will generate an error

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 is the output of the following pseudo code?

Int a =456,b,c,d=10;
b=a/d;
c=a-b;
print c;

Decision-Making

Decision-Making

Iteration

Iteration

Recursion

Recursion

Object Oriented Programming

Object Oriented Programming

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Integer a =40, b =35, c=20, d =10
Comment about the output of the following two statements •
Print a*b/c-d
Print a*b/(c-d)

Comment about the output of the following two statements

Differ by 80

Differ by 80

Same

Same

Differ by 50

Differ by 50

Differ by 160

Differ by 160

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Ravi and Rupali are asked to write a program to sum the rows of 2X2 matrices stored in the array A.
Ravi writes the following code (Code A):
for n = 0 to 1
sumRow1[n] = A[n][1] + A[n][2]
end
Rupali writes the following code (Code B):
sumRow1[0] = A[0][1] + A[0][2]
sumRow1[1] = A[1][1] + A[1][2]
Comment upon these codes (Assume no loop­ unrolling done by compiler):

Code A will execute faster than Code B

Code A will execute faster than Code B

Code B will execute faster than Code A

Code B will execute faster than Code A

Code A is logically incorrect.

Code A is logically incorrect.

Code B is logically incorrect.

Code B is logically incorrect.

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
The construct “if (condition) then A else B” is for which of the following purposes?

Iteration

Iteration

Decision Making

Decision Making

Recursion

Recursion

Object Oriented Programming

Object Oriented Programming

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Ashima wants to print a pattern which includes checking and changing a variables value iteratively She decides to use a loop/condition Which of the following options should she use such that the body of the loop/condition is executed atleast once whether the variable satisfies the entering condition or not?

For loop

For loop

While Loop

While Loop

Do while loop

Do while loop

Switch case

Switch case

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
function main() { integer a=5,b=7 switch(a) { case 5 :print "I am 5" break case b:print "I am not 5" break default:print "I am different" } }

I am 5

I am 5

I am not 5

I am not 5

I am different

I am different

Error

Error

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Recursion is a method in which the solution of a problem depends on ____________

Larger instances of different problems

Larger instances of different problems

Larger instances of the same problem

Larger instances of the same problem

Smaller instances of the same problem

Smaller instances of the same problem

Smaller instances of different problems

Smaller instances of different problems

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Which of the following problems can be solved using recursion?

Factorial of a number

Factorial of a number

Nth fibonacci number

Nth fibonacci number

Length of a string

Length of a string

All of the mentioned

All of the mentioned

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Recursion is similar to which of the following?

Switch Case

Switch Case

Loop

Loop

If-else

If-else

None of the mentioned

None of the mentioned

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! \r\n \r\n","Keep trying! \r\n \r\n","Not bad! \r\n \r\n","Good work! \r\n \r\n","Perfect! \r\n \r\n"]

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%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assurance

Get Access to PrepInsta Placement Cell

Top Faculty

from FAANG/IITs/TOP MNC's

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.

Comments