Question 1

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"
}
}

For Loop

For Loop

While Loop

While Loop

Do While Loop

Do While Loop

Switch Case

Switch Case

Question 2

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?

Decision-Making

Decision-Making

Iteration

Iteration

Recursion

Recursion

Object Oriented Programming

Object Oriented Programming

Question 3

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

1)
2)
3)
4)

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.

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

411.4

411.4

411

411

410.4

410.4

410

410

Question 5

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

For Loop

For Loop

While Loop

While Loop

Do While Loop

Do While Loop

Switch Case

Switch Case

Question 6

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

Question 7

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?

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

Question 8

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

Differ by 80

Differ by 80

Same

Same

Differ by 50

Differ by 50

Differ by 160

Differ by 160

Question 9

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

I am 5

I am 5

I am not 5

I am not 5

I am different

I am different

Error

Error

null
null

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 Assistance

Get Access to PrepInsta Prime

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