Question 1

Time: 00:00:00
Predict the output of the questions -
Function main() {
double d = 123.4
static float f =123.4
if (m equals i)
print ”Both of them are equal”
else if( f > d )
print ”Float is greater”
else
print ”Double is greater”
}

Float is greater

Float is greater

Double is greater

Double is greater

Both of them are equal

Both of them are equal

Code will generate error

Code will generate error

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

Please login to submit your explanation

Question 2

Time: 00:00:00
As a project, Parag wants to write a code which should increment its value until a condition is satisfied. Which type of structure should he be using?

while

while

do while

do while

for

for

switch

switch

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

Please login to submit your explanation

Question 3

Time: 00:00:00
Predict the output of the following code

int p = 1256, q ,r, s=10;

q=p/s;

r=p-q;

print r;

nothing gets printed

nothing gets printed

1136

1136

2215

2215

1131

1131

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

Please login to submit your explanation

Question 4

Time: 00:00:00
function foo() {
int a = 0;
switch(a) {
case 0 : print "2";
case 2 : print "2";
case 4 : print "2";
}

2

2

error

error

Not Sure

Not Sure

222

222

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

Please login to submit your explanation

Question 5

Time: 00:00:00
Predict the output of the following Code
function foo()
{
int a= 245,b=5, d;
d = a/b
switch(d)
{
case 4 :print "I behaved correctly"
break
case 49:print "I behaved with accuracy"
break
default:print "Not Sure"
}
}

"I behaved correctly"

"I behaved correctly"

"I behaved with accuracy"

"I behaved with accuracy"

"Not Sure"

"Not Sure"

error

error

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

Please login to submit your explanation

Question 6

Time: 00:00:00
Which of the following is used to iteratively do the same thing again and again with auto feeding values?

if-else-if

if-else-if

if-else

if-else

if

if

recursion

recursion

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

Please login to submit your explanation

Question 7

Time: 00:00:00
Int a = 20, b =10, c = 20, d =10

Print a*b/c-d

Print a*b/(c-d)

Will the output be same for the two ?

yes

yes

no

no

not sure

not sure

error

error

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

Please login to submit your explanation

Question 8

Time: 00:00:00
Predict the output of the following -
#include <stdio.h>

int fun(int n)
{
if (n == 4)
return n;
else return 2*fun(n+1);
}

int main()
{
printf("%d ", fun(2));
return 0;
}

40

40

32

32

24

24

16

16

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

Please login to submit your explanation

Question 9

Time: 00:00:00
What will be the output of following program ?
#include<stdio.h>
int main( )
{
int a=300,b,c;
if(a>=400)
b=300;
c=200;
printf("%d,%d\n",b,c);
return 0;
}

error

error

zero(0)

zero(0)

Garbage,200

Garbage,200

200,300

200,300

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

Please login to submit your explanation

Question 10

Time: 00:00:00
What will be the output of code?
#include<stdio.h>
int main( )
{
int x=3,y,z;
y=x=10;
z=x<10;
printf("x=%dy=%dz=%d\n",x,y,z);
return 0;
}

10,10,any value less than 10

10,10,any value less than 10

10,10,3

10,10,3

error

error

3,0,0

3,0,0

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

Please login to submit your explanation

PrepInsta User

the output is 10,10,0 so the answer is A

["0","40","60","80","100"]
["Need more practice! \r\n \r\n \r\n","Keep trying! \r\n \r\n \r\n","Not bad! \r\n \r\n \r\n","Good work! \r\n \r\n \r\n","Perfect! \r\n \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 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