C Data Types Questions 2

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 is the output of the given program ?
#include<stdio.h> 
int main()
{
unsigned int a = -1;
int b = ~0;
if (a == b)
printf("same");
else
printf("not same");
return 0;
}

same

same

not same

not same

compiler error.

compiler error.

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What is the output of the C code given below ?
#include<stdio.h> 
int main()
{
unsigned int a = -1;
int b = 0;
if (a == b)
printf("same");
else
printf("not same");
return 0;
}

same

same

not same

not same

compiler error.

compiler error.

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Which the following is not a valid declaration ?

  1. short int i;

  2. short i;

  3. short unsigned  i;

  4. short signed i;

only 3

only 3

3 and 4

3 and 4

2, 3 and 4

2, 3 and 4

All are valid.

All are valid.

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
For declarations :
float      a = 5.69;
double b = 2.17;
long double c = 2.17;

Which is the following is the correct way to print these values ?

printf( “%f %f %f” ,x,y,z);

printf( “%f %f %f” ,x,y,z);

printf( "%f %ff %fff" ,x,y,z);

printf( "%f %ff %fff" ,x,y,z);

printf( "%f %lf %Lf" ,x,y,z);

printf( "%f %lf %Lf" ,x,y,z);

printf( "%f %lf %llf" ,x,y,z);

printf( "%f %lf %llf" ,x,y,z);

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
typedef in C can be used as an alias of

a function pointer

a function pointer

an array

an array

compound data types such as struct and union

compound data types such as struct and union

both compound data types and pointer to these compound types

both compound data types and pointer to these compound types

All of the above.

All of the above.

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!","Keep trying!","Not bad!","Good work!","Perfect!"]
Hey ! Follow us on G+