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
What will be the output of the following C code?



  1.     #include <stdio.h>



  2.     int main()



  3.     {



  4.         int a[5] = {1, 2, 3, 4, 5};



  5.         int i;



  6.         for (i = 0; i < 5; i++)



  7.             if ((char)a[i] == '5')



  8.                 printf("%d\n", a[i]);



  9.             else



  10.                 printf("FAIL\n");



  11.     }


The compiler will flag an error

The compiler will flag an error

The program will compile and print the output 5

The program will compile and print the output 5

The program will compile and print the ASCII value of 5

The program will compile and print the ASCII value of 5

The program will compile and print FAIL for 5 times

The program will compile and print FAIL for 5 times

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

Please login to submit your explanation

Question 2

Time: 00:00:00
 The format identifier ‘%i’ is also used for _____ data type.

char

char

int

int

float

float

double

double

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

Please login to submit your explanation

Question 3

Time: 00:00:00
Which data type is most suitable for storing a number 65000 in a 32-bit system?

signed short

signed short

unsigned short

unsigned short

long

long

int

int

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

Please login to submit your explanation

Question 4

Time: 00:00:00
Which of the following is a User-defined data type?

typedef int Boolean;

typedef int Boolean;

typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;

typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;

struct {char name[10], int age}

struct {char name[10], int age}

all of the mentioned

all of the mentioned

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

Please login to submit your explanation

Question 5

Time: 00:00:00
What is the size of an int data type?

4 Bytes

4 Bytes

8 Bytes

8 Bytes

Depends on the system/compiler

Depends on the system/compiler

Cannot be determined

Cannot be determined

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

Please login to submit your explanation

Question 6

Time: 00:00:00
What is the output of the following C code?



  1.  #include  <stdio.h>



  2.     int main()



  3.     {



  4.        signed char chr;



  5.        chr = 128;



  6.        printf("%d\n", chr);



  7.        return 0;



  8.     }


128

128

-128

-128

Depends on the compiler

Depends on the compiler

None of the mentioned

None of the mentioned

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 C code?



  1.   #include  <stdio.h>



  2.     int main()



  3.     {



  4.         char c;



  5.         int i = 0;



  6.         FILE *file;



  7.         file = fopen("test.txt", "w+");



  8.         fprintf(file, "%c", 'a');



  9.         fprintf(file, "%c", -1);



  10.         fprintf(file, "%c", 'b');



  11.         fclose(file);



  12.         file = fopen("test.txt", "r");



  13.         while ((c = fgetc(file)) !=  -1)



  14.             printf("%c", c);



  15.         return 0;



  16.     }


a

a

Infinite loop

Infinite loop

Depends on what fgetc returns

Depends on what fgetc returns

Depends on the compiler

Depends on the compiler

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

Please login to submit your explanation

Question 8

Time: 00:00:00
What is short int in C programming?

The basic data type of C

The basic data type of C

Qualifier

Qualifier

Short is the qualifier and int is the basic data type

Short is the qualifier and int is the basic data type

All of the mentioned

All of the mentioned

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 the following C code?



  1.   #include <stdio.h>



  2.     int main()



  3.     {



  4.         float f1 = 0.1;



  5.         if (f1 == 0.1)



  6.             printf("equal\n");



  7.         else



  8.             printf("not equal\n");



  9.     }


equal

equal

not equal

not equal

output depends on the compiler

output depends on the compiler

none of the mentioned

none of the mentioned

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 the following C code?










  1.     #include <stdio.h>



  2.     int main()



  3.     {



  4.         float f1 = 0.1;



  5.         if (f1 == 0.1f)



  6.             printf("equal\n");



  7.         else



  8.             printf("not equal\n");



  9.     }









equal

equal

not equal

not equal

output depends on compiler

output depends on compiler

none of the mentioned

none of the mentioned

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!"]