C Quiz on Octal Decimal and Hexadecimal Numbers

C Quiz on Octal Decimal and Hexadecimal Numbers | Guess the output of the programs given in the quiz?

If you finding difficulties to solve these questions then first you should learn these:- 

Q1) Find the output of the given C program.

#include<stdio.h>
int main()
{
  printf("%o",65);
  return 0;
}

a) 101
b) 4
c) 65
d) ‘A’

View Answer Answer:- a) 101

Decimal to octal conversion

Q2) Find the output of the given C program.

#include<stdio.h>
int main()
{
  printf("%x",65);
  return 0;
}

a) ‘A’
b) 101
c) 41
d) 65

View Answer Answer:- c) 41

Decimal to Hexadecimal conversion

Q3) Find the output of the given C program.

#include<stdio.h>
int main()
{
  printf("%x",95);
  return 0;
}

a) 5f
b) 41
c) f5
d) 16

View Answer Answer:- a) 5f

Decimal to hexadecimal conversion. Note that if we use capital X in place of small x then we get 5F in place of 5f; printf(“%X”,95);

Q4) Find the output of the given C program.

#include<stdio.h>
int main()
{
  printf("%d",0123);
  return 0;
}

a) 0123
b) 123
c) None of these
d) 83

View Answer Answer:- d) 83

Octal to decimal conversion. In C language, when the number started with zero then it is an octal number.

Q5) Find the output of the given C program.

#include<stdio.h>
int main()
{
  printf("%d",0x1A4);
  return 0;
}

a) 400
b) 1A4
c) 420
d) None of these

View Answer Answer:- c) 420

Hexadecimal to decimal conversion. In C language, when the number is started with 0x or 0X then it is a hexadecimal number.

If you enjoyed this post, share it with your friends. Do you want to share more information about the topic discussed above or do you find anything incorrect? Let us know in the comments. Thank you!

Similar Quiz in C

Learn programs

Leave a Comment

Your email address will not be published. Required fields are marked *