Mphasis Iteration-Recursions-Decisions Quiz 1

Question 1

Time: 00:00:00
Predict the output of the questions -
Function main() {
double d = 123.4
static float f =123.4
if (d==f)
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

Code will generate error

Code will generate error

Both of them are equal

Both of them are equal

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

Please login to submit your explanation

Start

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?

For

For

While

While

Do while

Do while

Perforate

Perforate

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

Please login to submit your explanation

Start

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;

126

126

1131

1131

125.6

125.6

1130.6

1130.6

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

Please login to submit your explanation

Start

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

nothing gets printed

nothing gets printed

2

2

2

2

222

222

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

Please login to submit your explanation

Start

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

Start

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?

For Loop

For Loop

do while

do while

if

if

Recursion

Recursion

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Integer 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 ?

The output will have a difference of 20

The output will have a difference of 20

Will be same

Will be same

Cant be said depends on compiler

Cant be said depends on compiler

differ by 100

differ by 100

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

Please login to submit your explanation

Start

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

2

2

8

8

16

16

32

32

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 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,%d\n",a,b,c);
return 0;
}

Garbage value, Garbage Value

Garbage value, Garbage Value

300,200

300,200

200,300

200,300

300, Garbage, 200

300, Garbage, 200

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

Please login to submit your explanation

Start

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("\nx = %d y = %d z = %d", x,y,z);
return 0;
}

10,10,10

10,10,10

10,10,0

10,10,0

0,0,0

0,0,0

0,10,10

0,10,10

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 \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%

Completed

0/10

Accuracy

0%

Prime Video

Prime Video

Complete Video Course for Mphasis

For Mphasis
Prime Video

Prime Mock

Prime Mock

Topic-Wise Full Mock and much more

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

August 12, 2021

Comments