# 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?

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’

Ans:- 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

Ans:- c) 41

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

Ans:- 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

Ans:- 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

Ans:- c) 420

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

Similar Quiz in C

Learn programs