Quiz-1

Hello PrepSter,

If you find any errors in the quiz below kindly comment in the comment section and we will make it our priority to fix it.

Also if you have a better of the solution to the questions, please do comment them below and if we find it better than ours, we will post it in our website.

Question 1

Time: 00:00:00
Find the output of the program
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf(“Alpingi”);
}
return 0;
}

Infinite times

Infinite times

11 times

11 times

0 times

0 times

10 times

10 times

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

Please login to submit your explanation

Question 2

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

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

Question 4

Time: 00:00:00
Find the output of the program
#include<stdio.h>
int main()
{
int i=1;
for(;;)
{
printf(“%d\n”, i++);
if(i>10)
break;
}
return 0;
}

There should be a condition in the for loop

There should be a condition in the for loop

The two semicolons should be dropped

The two semicolons should be dropped

The for loop should be replaced with while loop.

The for loop should be replaced with while loop.

No error

No error

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

Please login to submit your explanation

Question 5

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

Question 6

Time: 00:00:00
What will be the output of the following pseudo-code statements:
integer a = 456, b, c, d =10
b = a/d
c = a – b
print c

410

410

410.4

410.4

411.4

411.4

411

411

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

Please login to submit your explanation

Question 7

Time: 00:00:00
What will be the output of the following pseudo-code statements:
integer a = 984, b, c, d =10
print remainder(a,d) // remainder when a is divided by d
a = a/d
print remainder(a,d) // remainder when a is divided by d

48

48

ERROR

ERROR

84

84

44

44

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

Please login to submit your explanation

Question 8

Time: 00:00:00
A company offers commission for selling it products to its salesperson. The

commission rate is Rs. 5 per product. However if the salesperson sells more than 200

items, he gets a commission of Rs. 10 on all items he sold after the first 200. Kanu

writes a program to calculate the commission for the salesperson:

integer numberProducts, commission

input numberProducts

if ( numberProducts > 200 )

— MISSING STATEMENT —

else

commission = numberProducts * 5

end if

print commission

Fill in the missing statement.

commission = (numberProducts – 200) * 10

commission = (numberProducts – 200) * 10

commission = 200 * 5 + (numberProducts – 200) * 10

commission = 200 * 5 + (numberProducts – 200) * 10

commission = numberProducts * 10

commission = numberProducts * 10

None of these

None of these

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

Please login to submit your explanation

Question 9

Time: 00:00:00
. Vikram wants to write a program which checks whether the inputted number

is divisible by any of the first 6 natural numbers (excluding 1). He writes the following

efficient code for it.

int number, n = 2, isdivisible=0

input number

while ( n <=6) // Statement 1

{

if ( remainder (number, n) == 0)

isdivisible = 1

end

n = n+1 // Statement 2

}

if (isdivisible equals 1)

print “It is divisible”

else

print “It is not divisible”

end

Vikram takes the program to Hari. Hari tells Vikram that though the code is correct, it

can be made more efficient. Hari modifies a single statement and makes the code

more efficient. Which statement does he modify and how?

Statement 1 is changed to: while (n <=6 AND isdivisible=0)

Statement 1 is changed to: while (n <=6 AND isdivisible=0)

Statement 1 is changed to: while (n <=6 OR isdivisible=0)

Statement 1 is changed to: while (n <=6 OR isdivisible=0)

Statement 1 is changed to: while (isdivisible=0)

Statement 1 is changed to: while (isdivisible=0)

Statement 2 is changed to: n = n + 2

Statement 2 is changed to: n = n + 2

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

Please login to submit your explanation

Question 10

Time: 00:00:00
 I have a problem to solve which takes as input a number n. The problem has a

prAnswererty that given the solution for (n-1), I can easily solve the problem for n. Which

programming technique will I use to solve such a problem?

Iteration

Iteration

Decision-making

Decision-making

Object Oriented Programming

Object Oriented Programming

Recursion

Recursion

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

Please login to submit your explanation

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]
Hey ! Follow us on G+