0% found this document useful (0 votes)
26 views

C Technical Upto Data Types

C Technical Data Types

Uploaded by

patilthetrainer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

C Technical Upto Data Types

C Technical Data Types

Uploaded by

patilthetrainer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Technical Questions upto Data types in C:

1. What will be the output of the following.

#include<stdio.h>
void main()
{
char ch=’a’;

printf(“\n value of ch is %d”,ch);


}
Answer:
a.97 b.97.000000 c.a d.error

2. What is the maximum range of int data type in 32 bit compilers?


Answer:
a. 32767 b.32768 c. 2147483647 d.2147483648

3. What is the output of the following program


#include<stdio.h>
Void main()
{
float x=345.34;
float y=23.12;

printf(“\n modulus of the x and y are %f”,x%y);


}
Answer:
a.322.22 b.322 c. 322.220000 d.error

4. What is the output of the following code.


#include<stdio.h>
void main()
{
char name[15];
int rollnum;

rollnum=10001;
name=”Sumanth”;

printf(“ %d %s”,rollnum,name);
}
Answers:
a. 10001 Sumanth b.10001 c.error d.Sumanth

5. Look into the following code.


#include<stdio.h>
void main()
{
int x;

printf(“\n input a character “);


x=getchar();

printf(“\n %d”,x);
}

If the input character is ‘b’, what will be the output?


Answers:
a. b b.97 c.98 d.66

6. What will be the output of the following code.


#include<stdio.h>
void main()
{
int x,y,z,res;

x=10; y=20; z=30;

res=x,y,z;

printf(“\n value of res is %d”,res);


}
Answers:
a.10 b.20 c.30 d.error

7. What will be the output of the following code.


#include<stdio.h>
void main()
{
int x,y,z;

x,y,z=10,20,30;

printf(“\n %d %d %d”,x,y,z);
}
Answers:
a. 10 20 30 b.10 10 10 c. error d.unknown values

8. What will be the output of the following.


#include<stdio.h>
void main()
{
int x,y;

x=5; y=10;
y=x++;

printf(“\n %d %d”,x,y);
}
Answers:
a. 5 10 b. 5 6 c. 6 5 d. 6 6
9. What will be the output of the following.
#include<stdio.h>
void main()
{
int x,y;

x=5;

x=x++ + x++;
printf(“\n %d”,x);
}
Answers:
a. 11 b. 7 c. 12 d. 13

10. What will be the output of the following.


#include<stdio.h>
void main()
{
int x,y;

x=5;

x=++x + ++x;
printf(“\n %d”,x);
}
Answers:
b. 13 b. 12 c. 14 d. 7

11. What will be the output of the following.


#include<stdio.h>
void main()
{
int x,y;

x=5;

x=x++ + x++ + x++;


printf(“\n %d”,x);
}
Answers:
a. 17 b. 18 c. 21 d. 7

12. Write a C program to input a float value, then print only the fractional portion of the given number;

Ex: 346.65

Output must be : 65

13. What will be the output of the following code.


#include <stdio.h>
vod main()
{
int a;
int b = 5;
a = 0 && --b;
printf("%d %d", a, b);

}
Answer:
a. 0 5 b. 0 4 c. error d. 0 0

14. What will be the output of the following


void main()
{
printf(2+”Kakateeya University ”);
}

15. What will be the output of the following


void main( )
{
int i=99,x=5;

printf((x>7)?”%d”:”%c”,i);
}
Answers:
a. compilation error b. c c. z d. 107

16. What will be the output of the following


void main()
{
Int x = 5;
x = x / x++;

printf(“\n %d”,x);

Answers:
a. 5 b. 1 c.0 d.error

17. Find the output of the following code

#include <stdio.h>
void main()
{
float x = 5;
int y=4;

printf("\n %d %f",x,y);
}
Answers:
a. 5 4.000000 b.5.000000 4 c.5.000000 4.000000 d.0 0.000000

18. What is difference between these two constants 23.15, 23.15f ?

19.
#include <stdio.h>
void main()
{
char c1='a',c2='b',c;

c=c1+c2;
if(c>'c')
printf("\n True ");
else
printf("\n False");
}

20.
#include <stdio.h>
void main()
{
signed char ch;

printf("\n %d ",ch=128);
/* output will be -128, because
equallent binary of 128 is : 1000 0000
here (msb)1 000 000 0(lsb)
-128 -> 2's complement notation
abs(-128) =128
1000 0000
0111 1111 (1's complement)
+1
------------
100 0000 */

21.
#include <stdio.h>
void main()
{
if(sizeof(int)>-1)
// result of sizeof (int) is 4, which is signed int which is comparing with unsigned int -1
printf("\n True ");
else
printf("\n False "); */

22.
#include<stdio.h>
void main()
{
float f=0.1;

if(f==0.1)
// here f is float type and 0.1 is higher degree of float i.e double
// with large precession float with 6 digits precession and double is with
10 digits of precession
printf("\n True ");
else
printf("\n False "); */
}
23.
#include<stdio.h>
{
int a,b=1,c=1;
a=sizeof(c=++b +1);

// here, sizeof operator is compile time operator which will found the
//size of c during compilation the expression will not be executed hence b remains 1

printf("\n a=%d ,b=%d, c=%d",a,b,c);


}

24.
#include<stdio.h>
void main()
{
char ch;
printf("%d",ch=255);
}
(ascii codes uses 0-128, -128, -127……-1)
25.
#include<stdio.h>
void main()
{
float f=12.50; // separate rupees and paise

int rs=(int)f;
int ps=((int)(f*100)%100);

printf("\n %d %d ",rs,ps);
}

26. What will be the binary equallent of 255(10).


a. 1001 0001 b. 1111 1111 c.1111 1110 d.0000 1111

27. 2’s Complement of 1001 1001 is :


a.0110 0111 b.0110 0110 c.0101 0101 d.0111 0111

28. The Binary addition result of 10101011 + 11000000 is


a. 01010100 b.00111111 c.0101101011 d. 00101010

29. The Binary addition result of 01010101 + 00001111 is


a.01100100 b.1111010 c.10011011 d.10101010

You might also like