Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

C Programming :: Variables & Data Types

Home > C Programming > Variables & Data Types > General Questions

31. What will be output of the following "c" code?

#include
void main()
{
register int a=2;
printf("Address of a = %p",&a);
printf("Value of a = %d",a);
}

Answer: Option A

Explanation:

& (address of ) operator cannot be applied on register variables.

Workspace


Tags:  No Tags on this question yet!

32. What will be output of the following "c" code?

#include
void main()
{
extern i;
printf("%d\n",i);
{
int i=20;
printf("%d\n",i);
}
}

Answer: Option C

Explanation:

The identifier i is available in the inner block
so using extern has no use in resolving it.

Workspace


Tags:  No Tags on this question yet!

33. What will be output of the following "c" code?

#include
void main(){
float a=5.2;
if(a==5.2)
printf("Equal");
else if(a<5.2)
printf("Less than");
else
printf("Greater than");
}

Answer: Option C

Explanation:

5.2 is a double-type constant in C. In C, size of double-type data is 8 bytes while variable 'a' is of float-type. Size of float variable is 4 bytes.
So, double-type constant, i.e, 5.2 is stored in the memory as-
101.00 11001100 11001100 11001100 11001100 11001100 11001101
On the other hand, content of variable 'a' will be stored in the memory as-
101.00110 01100110 01100110
It is clear that variable 'a' is less than the double-type constant 5.2.
Hence, the output is Less than.

Workspace


Tags:  No Tags on this question yet!

Answer: Option B

Explanation:

Real number generally means non-complex floating-point numbers. It includes both rational and irrational numbers.

When the accuracy of the floating point number is insufficient, we can use 'double' to define the number. The 'double' is same as 'float' but with longer precision and takes double space (8 bytes) than float.

To extend the precision further we can use 'long double', which occupies 10 bytes of memory space.

Workspace


Tags:  No Tags on this question yet!

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

36. When a variable of data type double is converted into float, then

Answer: Option A

Explanation:

float and double don't store decimal places, rather they store binary places. Assuming IEEE 754, float is 24 significant bits(7.22 decimal digits), and double is 53 significant bits(15.95 decimal digits).

Hence, converting from double to float will give you the closest possible, or you can say rounding-off takes place.


Workspace


Tags:  No Tags on this question yet!

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

39. What is the output of the program?

#include
int main()
{
extern int a;
printf("%d\n",a);
return 0;
}

int a =20;

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  nagarro

40. What will be the output?

main()
{
int i=3,a=4,n;
float t=4.2;
n = a*a / i + i / 2 * t + 2 + t;
printf("%d",n);
}

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Wipro



Most Popular Qs.

Latest MCQ Qs.