Computer Programming (3310701) MCQs

MCQs of Decision Statements

Showing 21 to 26 out of 26 Questions
21.


if (a > b)
if (b > c)
s1 ;
else s2;

s2 will be executed if __________ .


if (a > b)
if (b > c)
s1 ;
else s2;

આપેલા કોડ માં s2 ક્યારે execute થશે?

(a)

a <= b

(b)

b > c

(c)

b <= c and a <=b

(d)

a> b and b <= c

Answer:

Option (d)

22.

if (a>b)
   printf("a>b");
else
   printf("else part");
   printf("a<=b");

"else part" will be printed if _________ .

if (a>b)
   printf("a>b");
else
   printf("else part");
   printf("a<=b");

આપેલા કોડ માં "else part" ક્યારે પ્રિન્ટ થશે?

(a)

a>b

(b)

a<b

(c)

a <= b

(d)

a>=b

Answer:

Option (b)

23.

Guess the output?

#include<stdio.h>
void main()
{
       int num1 = 'A';

       switch(num1)
       {
              case 'A':
                         printf("Case1");
                         break;
              case 65:
                         printf("Case2");
                         break;
        }
}

આપેલા પ્રોગ્રામ નું આઉટપુટ શું હશે?

#include<stdio.h>
void main()
{
       int num1 = 'A';

       switch(num1)
       {
              case 'A':
                         printf("Case1");
                         break;
              case 65:
                         printf("Case2");
                         break;
        }
}

(a)

Case1

(b)

Case2

(c)

Case1 Case2

(d)

Compilation error - Duplicate case value

Answer:

Option (d)

24.

Guess the output?

main()
{
       int x=15;
       printf("\n%d%d%d",x!=15,x=20,x<30);
}

આપેલા પ્રોગ્રામ નું આઉટપુટ શું હશે?

main()
{
       int x=15;
       printf("\n%d%d%d",x!=15,x=20,x<30);
}

(a)

0,20,1

(b)

15,20,30

(c)

0,0,0

(d)

error

Answer:

Option (a)

25.

In switch character constants are automatically converted to _________ .

switch માં કેરેક્ટર કોન્સ્ટન્ટ્સ ________ માં ઓટોમેટિક કન્વર્ટ થાય છે.

(a)

float

(b)

double

(c)

integer

(d)

boolean values

Answer:

Option (c)

26.

The keyword else can be used with _______ .

else કીવર્ડ _______ સાથે યુઝ થઈ શકે.

(a)

if statement

(b)

switch()

(c)

do….While()

(d)

while() loop

Answer:

Option (a)

Showing 21 to 26 out of 26 Questions