h

C ,C++, SQL,PL/SQL Search Engine

Custom Search

Java,Advance Java,Java script and ebook Search Engine

Big collection of c and java questions

Explanations of questions in easily way

C programming questions and answer

(1)

#include"stdio.h"

void main(){

long double a=55555;

clrscr();

printf("%.2LE,%.2Le",a);

getch();

}

What will be output if you will execute above code?

(a) 5.56e+04, 5.56E+04

(b) 5.6e+04, 5.6E+04

(c) 5.56E+04, 5.56e+04

(d)Compiler error.

(e)None of the above.

(2)

#include"stdio.h"

void main(){

signed a=5;

unsigned b=5;

clrscr();

if(a==b)

printf("EQUAL");

else

printf("UNEQUAL");

getch();

}

What will be output if you will execute above code?

(a) EQUAL

(b) UNEQUAL

(c) Print nothing

(d) Compiler error.

(e) None of the above

(3)

#include"stdio.h"

void main(){

fputs("STANDARD PRINTER DEVICE",stdprn);

getch();

}

What will be output if you will execute above code?

(a) STANDARD PRINTER DEVICE (on the paper)

(b) STANDARD PRINTER DEVICE (on the standard output device)

(c) Print nothing

(d)Compiler error.

(e)None of the above.

(4)

#include"stdio.h"

void main(){

char a='\';

clrscr();

printf("%c",a);

getch();

}

What will be output if you will execute above code?

(a)\

(b)\\

(c)Print nothing

(d)Compiler error.

(e)None of the above.

(5)

#include"stdio.h"

void main(){

char a='\7',b='\8';

clrscr();

printf("%d %d",a,b);

getch();

}

What will be output if you will execute above code?

(a) 7 8

(b) 7 56

(c) 55 56

(d) Compiler error.

(e) None of the above.

(6)

#include"stdio.h"

void main(){

char a='\10';

char *str1="cquestion",*str2="bank";

clrscr();

printf("%s%c%s",str1,a,str2);

getch();

}

What will be output if you will execute above code?

(a) cquestionbank

(b) cquestioba

(c) cquestiobank

(d) Compiler error.

(e) None of the above.

(7)

#include"stdio.h"

void main(){

char a='\11';

char *str1="cquestion",*str2="bank";

clrscr();

printf("%d",printf("%s%c%s",str1,a,str2));

getch();

}

What will be output if you will execute above code?

(a) cquestionbank

(b) cquestionbank14

(c) cquestion bank14

(d)Compiler error.

(e)None of the above.

(8)

#include"stdio.h"

void main(){

char a='\12';

char *str1="cquestion",*str2="bank";

clrscr();

printf("%s%c%s",str1,a,str2);

getch();

}

What will be output if you will execute above code?

(a) cquestionbank

(b) cquestion

bank

(c) bankcquestion

(d) Compiler error.

(e) None of the above.

(9)

#include"stdio.h"

void main(){

char a='\377';

clrscr();

printf(2+"%d%o",a);

getch();

}

What will be output if you will execute above code?

(a) 379

(b) 377

(c) 177777

(d) Compiler error.

(e) None of the above.

(10)

#include"stdio.h"

void main(){

char a='\378';

clrscr();

printf("%o",a);

getch();

}

What will be output if you will execute above code?

(a) 177777

(b) 378

(c) 377

(d) Compiler error.

(e) None of the above.

(11)

void main(){

int goto=5;

printf("%d",goto);

getch()

}

What will be output if you will execute above code?

(a)5

(b)10

(c)15

(d)Compiler error.

(e)None of the above.

(12)

void main(){

long int 1a=5l;

printf("%ld",1a);

getch();

}

What will be output if you will execute above code?

(a)5

(b)51

(c)235

(d)Compiler error.

(e)None of the above.

(13)

void main(){

Char * emp name=”raja”;

printf("%s",emp name);

getch();

}

What will be output if you will execute above code?

(a)raja

(b)null

(c)Address of variable emp name

(d)Compiler error.

(e)None of the above.

(14)

void main(){

long int new=5l;

printf("%ld",new);

getch();

}

What will be output if you will execute above code?

(a)5

(b)10

(c)15

(d)Compiler error.

(e)None of the above.

(15)

void main(){

long int _=5l;

printf("%ld",_);

getch();

}

What will be output if you will execute above code?

(a)5

(b)10

(c)15

(d)Compiler error.

(e)None of the above.

(16)

void main(){

char * __WORLD__="world";

clrscr();

printf("%s ",__WORLD__);

getch();

}

What will be output if you will execute above code?

(a)world

(b)worl

(c)null

(d)Compiler error.

(e)None of the above.

(17)

void main(){

char * __TIME__="world";

clrscr();

printf("%s ",__TIME__);

getch();

}

What will be output if you will execute above code?

(a)world

(b)Current time

(c)null

(d)Compiler error.

(e)None of the above.

(18)

void main(){

long int a;

(float)a=6.5;

printf("%f",a);

getch();

}

What will be output if you will execute above code?

(a)6

(b)7

(c)6.5

(d)Compiler error.

(e)None of the above.

(19)

void main(){

long int a,b=10;

++a=b++;

printf("%d %d",a,b);

getch();

}

What will be output if you will execute above code?

(a)10 10

(b)11 11

(c)0 11

(d)Compiler error.

(e)None of the above.

(20)

void main(){

long int a,b=5;;

~a=++b + ++b + ++b;

printf("%d %d",++a,++b);

getch();

}

What will be output if you will execute above code?

(a) -10 9

(b) -11 8

(c) -11 9

(d) Compiler error.

(e) None of the above.

(21)

void main(){

int x;

int y;

x+y=10;

x=3;

printf("%d",y);

getch();

}

What will be output if you will execute above code?

(a)0

(b)7

(c)10

(d)Compiler error.

(e)None of the above.

(22)

void main(){

int x=5;

int y=10;

&x=y;

printf("%d %d",x,y);

getch();

}

What will be output if you will execute above code?

(a)5 10

(b)10 5

(c)10 10

(d)Compiler error.

(e)None of the above.

(23)

void main(){

const a=10;

a=~a;

printf("%d",a);

getch();

}

What will be output if you will execute above code?

(a) 10

(b)-11

(c)-10

(d)Compiler error.

(e)None of the above.

(24)

void main(){

const _=10;

int *p=&_;

printf("%d",*p);

getch();

}

What will be output if you will execute above code?

(a)Address of variable _

(b)20

(c)10

(d)Compiler error.

(e)None of the above.

(25)

void main(){

const int *a=12;

a++;

clrscr();

printf("%d",a);

getch();

}

What will be output if you will execute above code?

(a)12

(b)garbage value

(c)13

(d)Compiler error.

(e)None of the above.

output: garbage value

(26) What will be output of the following program ?

void main(){

const int *a=(const int * )12;

*a=(const int *)25;

clrscr();

printf("%d",a);

getch();

}

What will be output if you will execute above code?

(a)12

(b)25

(c)Address of variable a

(d)Compiler error.

(e)None of the above.

(27)

#include"stdio.h"

void main(){

char a='\15';

char *str1="cquestion",*str2="bank";

clrscr();

printf("%s%c%s",str1,a,str2);

getch();

}

What will be output if you will execute above code?

(a) bankstion

(b)cquestionbank

(c)bankcquestion

(d)Compiler error.

(e)None of the above.

Answer:

1. (c)

2. (a)

3. (a)

4. (d)

5. (b)

6. (c)

7. (c)

8. (b)

9. (c)

10. (d)

11. (d)

12. (d)

13. (d)

14. (a)

15. (a)

16. (a)

17. (d)

18. (d)

19. (d)

20. (d)

21. (d)

22. (d)

23. (d)

24. (c)

25. (b)

26. (d)

27. (a)

Explanation:

1. (c) %e or %E represent print the number in exponential format.

%e means output has small letter e.

%E means output has capital letter e.

2. (a) before any arithmetic operation small data type convert into higher data type i.e.signedto unsigned.

3. (a) PRINT IN CONNECTED PRINTER DEVICE, OTHERWISE

TURBO C WILL BE HANGED FOR SEARCHING OF PRINTER IN THE SYSTEM.

4. (d) Character is \ has special meaning in c programming.

e.g.

‘\0’ represents octal character.

‘\n’ represents new line character. So we cannot use ‘\’ directly.

5. (b) 8 is not octal digit. octal digits are(0,1,2,3,4,5,6,7).

So ‘\7’ is octal 7

‘\8’ some special character constant.

6. (c) ‘\10’ represent octal 10 i.e. decimal 8 which is ASCII code of backspaces (only one character)

7. (c) ‘\11’ represent octal 11 i.e. decimal 9 which is ASCII code of blank space.

8. (b) ‘\12’ represent octal 12 i.e. decimal 10 which is ASCII code of new line character i.e. send the cursor to next line

9. (c) ‘\377’ is octal character constant.

%o is used to print octal number system.

10. (d) Highest possible character constant is ‘\377’ which is

Equivalent to decimal 255.

11. (d) invalid variable name. goto is keyword in c.

12. (d) invalid variable name. Variable name must star from either alphabet or

under score.

13. (d) invalid variable name. Except underscore there should not be any special character in name of variable event blank space.

14. (a) We can use c++ keyword in variable name in c programming.(But should not use ,why ?)

15. (a) Under score is valid keyword in c.

16. (a) __WORLD__ is valid identifier in c programming language.

But we should not write variable name in the forma like __xyx__,

__TIME__. Why ?

17. (d) __TIME__ is valid identifier in c programming language but it is

Predefine global identifier .So a variable not should not be global

Identifier like __TIME__,__DATE___,__FILE__ etc.

18. (d) After applying any operator in variable name it always give a value.

(type): urinary type casting operator is not exception for this.

It is similar to write

3456=5

It is invalid c statement. Because left side of assignment operator must

Be a variable not any constant.

19. (d) After applying any operator in variable name it always give a value.

(type): urinary type casting operator is not exception for this.

It is similar to write

3456=5

It is invalid c statement. Because left side of assignment operator must

Be a variable not any constant.

20. (d) After applying any operator in variable name it always give a value.

(type): urinary type casting operator is not exception for this.

It is similar to write

3456=5

It is invalid c statement. Because left side of assignment operator must be a variable not any constant.

21. (d) After applying any operator in variable name it always give a value.

(type): urinary type casting operator is not exception for this.

It is similar to write

3456=5

It is invalid c statement. Because left side of assignment operator must be a variable not any constant.

22. (d) After applying any operator in variable name it always give a value.

(type): urinary type casting operator is not exception for this.

It is similar to write

3456=5

It is invalid c statement. Because left side of assignment operator must be a variable not any constant.

23. (d) we Cannot modify a const object.

24. (c) We can assign address of const object to its pointer.

Underscore is valid variable name.

25. (b) Explanation: Here address of variable a is constant not variable a. So we can modify variable a. Initial value of auto type data is garbage.

26. (d) we Cannot modify a const object.

Here address of variable a is constant not variable a.

27. (a) ‘\11’ represent octal 11 i.e. decimal 9 which is ASCII code of carriage return (return to first position of that line)

c interview questions and answer

(101) What is nesting of function?

(102) What is nesting of function?

(103) What is pragma directive?

(104) What is token pasting directive?

(105) How preprocessor works?

(106) Why preprocessor has introduced in C?

(107) What are differences between macro call and function?

(108) What is cascading of macro?

(109) What is self referential macro?

(110) What is stringzing operator?

(111) What is macro call?

(112) What is difference between # and ##?

(113) What is conditional compilation preprocessor directive?

(114) Which storage class is possible with function?

C PROGRAMMING INTERVIEW QUESTIONS AND ANSWER


(1) If static storage in c will not work then what problem will you face?

(2) If extern storage in c will not work then what problem will you face?

(3) Why we cannot initialize extern variables?

(4) What is trigraph in C?

(5) Why char data type can store two characters at a time?

(6) What is prototype of printf function?

Answer

(7) As we know any program which is possible using loop is also possible using function recursion. Then why loop in C?

(8) Add any two numbers without using addition operator.

(9) Subtract any two numbers without using subtraction operator?

(10) Declare and define a structure at the same time?

(11) What is self referential structure?

(12) What is difference between declaration and definition?

(13) Write a c program to print hello world without using any semi colon.

(14) What is difference between following two declarations?

1. char * a, b;

2. #define char * string

string a, b;

(15) Write a sacnf statement which can store a sentence which includes blank space to a variable.

(16) What is array of function?

(17) Write a function in c which executes before the main function?

(18) Write a function in c which executes after the main function?

(19) What is FILE pointer?

Answer

(20) What is far pointer in c?

(21) What is normalization in C?

(22) How does preprocessor work?

(23) Why typedef is storage class?

(24) If auto storage in c will not work then what problem will you face?

(25) Does printf function follow function overloading in c?

(26) What is command line argument?

(27) What is cyclic nature of data type?

(28) Can you modify const. variable by program? If yes then how?

(29) How integer data stores in memory?

(30) What is generic pointer?

(31) What is NULL pointer?

(32) What is dangling pointer?

(33) What is huge pointer?

(34) In which data type we can not use storage class and why?

(35) What is use of void pointer?

(36) What is difference between malloc and calloc function in c?

(37) What is difference between c and c++?

(38) What are global structures and unions?

(39) What is difference between structure and union?

(40) What is use of structure?

(41) What is use of union?

(42) What is variable number argument in C?

(43) What is ellipsis in C?

Answer

(44) How can you check particular bit is on or off?

(45) What is function recursion?

(46) What is nesting of function call?

(47) What is pointer?

(48) What is array in C?

(49) What is array of array?

(50) What is code and data area of memory?

(51) Find the size of data type without using sizeof operator?

(52) Compare two strings without using any string library function?

(53) What is necessity of declaration of a function?

(54) Write a printf statement without using any semi colon.

(55) What is array of pointer?

(56) What is array of function?

(57) What is array of structure?

(58) What is difference between pass by value and pass by reference?

(59) What is use of stack?

(60) What is use of void?

(61) What are Lvalue and Rvalue of data type?

(62) What is volatile qualifier in C?

(63) Write a c program to add two matrixes?

(64) Write a c program to multiple two matrixes?

(65) Write a c program to print diagonal element of a matrix?

(66) In which area of memory static variables store?

(67) What is heap area of memory?

(68)What are global identifiers in C?

(69) How can you assign an octal number to a variable in C?

(70) How can you assign a hexadecimal number to a variable in C?

(71) How to create own library function in C?

(72) What are enumerators in C?

(73) What is wild pointer?

(74) What is FILE pointer?

(75) What is far pointer?

(76) What is near pointer?

(77) What is difference between array and link list?

(78) What is difference between array of character and string?

(79) How can you open a file in C?

(80) How can you write in a file in C?

(81) How can you calculate size of union?

(82) How can you calculate size of a function?

(83) How can you calculate size of structure?

(84) How will initialize the member of union?

(85) Why we can initialize only first member of union?

(86) Which storage call is not allowed with structure?

(87) What is difference between structure and array?

(88) What is self referential structure?

(89) What is slack byte in structure?

(90) Why we cannot compare two same type of structure?

(91) What is alignment of structure member variables?

(92) How can you rename a structure?

(93) How can you rename a union?

(94) How can you rename a function?

(95) How can you rename an array?

(96) What is use of typdef keyword?

(97) How can you access the member of structure variables?

(98) How can you access the member of union variables?

(99) How bit level programming is possible using structure or union?

(100) What is nested structure?

Standard of questions ?