C interview questions – page 12

2,130 questions. Tap “Show answer” to check yourself.

Advertisement
  1. How much space is allocated by the expression " int *a[10]" if size of int is 4 and size of int pointer is 2

  2. How to allocate memory for 2D array using malloc()?

  3. What is :- pointer , NULL pointer , dangling pointer , far pointer , near pointer , huge pointer , generic pointer , smart pointer ?

  4. Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program. (NOTE: The key is, think UNIX).

  5. A C program that prints itself.

  6. Main() { printf("%s",printf("samsung")+fun()); } fun() { return "electronic"; }

  7. A string was given and its hash was computed

  8. What is the difference between typedef and # define? Which is better? Explain #define INT1 int*; typedef int* INT2; INT1 id1, id2; INT2 it1, it2;

  9. You're given the following program:

  10. Using c-strings write a program that will analyse the text"1.1my brother is taller than me.1.2 I am a boy of sixteen years old". The program should remove multiple spaces betweem words,find the longest word in the text,search and identify the number o

  11. What is the value of z?

  12. How are global variables in different files are resolved.

  13. Advertisement
  14. What is the value of y in the following code?

  15. Give the output of the following program

  16. API methods (a)file * getfiles(dir); (b) dir * getsubdirs(dir); were given, and 2 structures one representing file and other representing dir were given. It is provided that both the structures have many members but only the name field is kn...

  17. What's the similarity between structures and union?

  18. Is it possible to swap two variables without using a temporary variable? If yes how?

  19. How many BOOMs will be printed ?

  20. Convert this function to a macro.

  21. Let Sample.exe is a C compiled and linked file. What is the argc value in Sample.c for following command line

  22. Printf("""n""") prints n but printf(""n"") gives compile error

  23. What is the size of struct xyz (in bytes) in the following:

  24. Where do you initialize static class member variables?

  25. What does the following function return?

  26. Advertisement
  27. I have a 8 bit register ,in that each field having the some specific function. How to represent that in strutures by using the bit-fields.

  28. Assume the following C variable declaration

  29. How many time foo2() would get called given A<B 25% of the times and C<D 75% of the times and foo1() is called 5000 times

  30. X = malloc (y). Which of the following statements is correct. a) x is the size of the memory allocated b) y points to the memory allocated c) x points to the memory allocated d) none of the above

  31. Which is the valid declaration? a) #typedef struct { int i;}in; b) typedef struct in {int i;}; c) #typedef struct int {int i;}; d) typedef struct {int i;} in;

  32. How do you write a C program which can calculate lines of code but not counting comments?

Advertisement