Programming in C

C was initially used for system development work, particularly the programs that make-up the operating system. C was adopted as a system development language because it produces code that runs nearly as fast as the code written in assembly language.A C program can vary from 3 lines to millions of lines and it should be written into one or more text files with extension ".c"; for example, hello.c.

All keywords in C are in ____________
Variable name resolution (number of significant characters for the uniqueness of variable) depends on ___________
Which of the following is not a valid C variable name?
Which of the following is true for variable names in C?
What will be the output of the following C code?










  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  float f1 = 0.1;



  5.  if (f1 == 0.1)



  6.  printf("equal\n");



  7.  else



  8.  printf("not equal\n");



  9.  }









What will be the output of the following C code on a 32-bit machine?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int x = 10000;



  5.  double y = 56;



  6.  int *p = &x;



  7.  double *q = &y;



  8.  printf("p and q are %d and %d", sizeof(p), sizeof(q));



  9.  return 0;



  10.  }









Which is correct with respect to the size of the data types?

What will be the output of the following C code on a 64 bit machine?











  1.  #include <stdio.h>



  2.  union Sti



  3.  {



  4.  int nu;



  5.  char m;



  6.  };



  7.  int main()



  8.  {



  9.  union Sti s;



  10.  printf("%d", sizeof(s));



  11.  return 0;



  12.  }









enum types are processed by _________
Which of the following statement is false?

What will be the output of the following C code?











  1.  #include 



  2.  void main()



  3.  {



  4.  int k = 4;



  5.  int *const p = &k;



  6.  int r = 3;



  7.  p = &r;



  8.  printf("%d", p);



  9.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  printf("sanfoundry\rclass\n");



  5.  return 0;



  6.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  j = 10;



  5.  printf("%d\n", j++);



  6.  return 0;



  7.  }









Will the following C code compile without any error?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  for (int k = 0; k < 10; k++);



  5.  return 0;



  6.  }









Will the following C code compile without any error?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int k;



  5.  {



  6.  int k;



  7.  for (k = 0; k < 10; k++);



  8.  }



  9.  }









Which of the following declaration is not supported by C?
What is the precedence of arithmetic operators (from highest to lowest)?
Which of the following is not an arithmetic operation?
Which of the following data type will throw an error on modulus operation(%)?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int a = 10;



  5.  double b = 5.6;



  6.  int c;



  7.  c = a + b;



  8.  printf("%d", c);



  9.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  int x = 1, y = 0, z = 5;



  5.  int a = x && y && z++;



  6.  printf("%d", z);



  7.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  int x = 0, y = 2, z = 3;



  5.  int a = x & y | z;



  6.  printf("%d", a);



  7.  }









What will be the final value of j in the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int i = 10, j = 0;



  5.  if (i || (j = i + 10))



  6.  //do something



  7.  ;



  8.  }









What will be the output of the following C code?










  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int i = 1;



  5.  if (i++ && (i == 1))



  6.  printf("Yes\n");



  7.  else



  8.  printf("No\n");



  9.  }









function tolower(c) defined in library <ctype.h> works for ___________
Which type of conversion is NOT accepted?

What will be the data type of the result of the following operation?









(float)a * (int)b / (long)c * (double)d







Which of the following typecasting is accepted by C?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int i = 0;



  5.  int j = i++ + i;



  6.  printf("%d\n", j);



  7.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int i = 2;



  5.  int j = ++i + i;



  6.  printf("%d\n", j);



  7.  }









What is the difference between the following 2 codes?











  1.  #include <stdio.h> //Program 1



  2.  int main()



  3.  {



  4.  int d, a = 1, b = 2;



  5.  d = a++ + ++b;



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



  7.  }



















  1.  #include <stdio.h> //Program 2



  2.  int main()



  3.  {



  4.  int d, a = 1, b = 2;



  5.  d = a++ +++b;



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



  7.  }









For which of the following, “PI++;” code will fail?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int c = 2 ^ 3;



  5.  printf("%d\n", c);



  6.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int a = 2;



  5.  if (a >> 1)



  6.  printf("%d\n", a);



  7.  }









What will be the value of the following assignment expression?


 (x = foo())!= 1 considering foo() returns 2
Operation “a = a * b + a” can also be written as ___________

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int y = 1, x = 0;



  5.  int l = (y++, x++) ? y : x;



  6.  printf("%d\n", l);



  7.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  int k = 8;



  5.  int m = 7;



  6.  int z = k < m ? k++ : m++;



  7.  printf("%d", z);



  8.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  int b = 5 & 4 & 6;



  5.  printf("%d", b);



  6.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  int b = 5 & 4 | 6;



  5.  printf("%d", b);



  6.  }









Functions have static qualifier for its declaration by default.
Is initialisation mandatory for local static variables?
Assignment statements assigning value to local static variables are executed only once.
What is the format identifier for “static a = 20.5;”?
Which of the following is true for static variable?
register keyword mandates compiler to place it in machine register.
Register storage class can be specified to global variables.
Your new question!
Which among the following is wrong for “register int a;”?
Automatic variables are _________
What is the scope of automatic variable?
Automatic variables are allocated memory in ___________

What will be the x in the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  int x;



  5.  }









Automatic variables are initialized to ___________
Which of the following storage class supports char data type?
A local variable declaration with no storage class specified is by default _________
Property which allows to produce different executable for different platforms in C is called?
What is #include <stdio.h>?
C preprocessors can have compiler specific features.
Preprocessor feature that supply line numbers and filenames to compiler is called?
C preprocessor is conceptually the first step during compilation.
#include <somefile.h> are _______ files and #include “somefile.h” ________ files.
What is a preprocessor?

Comment on the following pointer declaration.


int *ptr, p;

Comment on the following C statement.


const int *ptr;
Which of the following can never be sent by call-by-value?
Which type of variables can have same name in different function?
Arguments that take input by user before running a program are called?
What is the maximum number of arguments that can be passed in a single function?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int ary[4] = {1, 2, 3, 4};



  5.  int *p = ary + 3;



  6.  printf("%d\n", p[-2]);



  7.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int a[4] = {1, 2, 3, 4};



  5.  int *p = &a[1];



  6.  int *ptr = &a[2];



  7.  ptr = ptr * 1;



  8.  printf("%d\n", *ptr);



  9.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int a[4] = {1, 2, 3, 4};



  5.  int *ptr = &a[2];



  6.  float n = 1;



  7.  ptr = ptr + n;



  8.  printf("%d\n", *ptr);



  9.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int a[4] = {1, 2, 3, 4};



  5.  void *p = &a[1];



  6.  void *ptr = &a[2];



  7.  int n = 1;



  8.  n = ptr - p;



  9.  printf("%d\n", n);



  10.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void f(char *k)



  3.  {



  4.  k++;



  5.  k[2] = 'm';



  6.  printf("%c\n", *k);



  7.  }



  8.  void main()



  9.  {



  10.  char s[] = "hello";



  11.  f(s);



  12.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  int k = 5;



  5.  int *p = &k;



  6.  int **m = &p;



  7.  **m = 6;



  8.  printf("%d\n", k);



  9.  }









Which of the following is not possible statically in C?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  char *p[1] = {"hello"};



  5.  printf("%s", (p)[0]);



  6.  return 0;



  7.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int main()



  3.  {



  4.  int i = 0, j = 1;



  5.  int *a[] = {&i, &j};



  6.  printf("%d", *a[0]);



  7.  return 0;



  8.  }









Which of the following declaration are illegal?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  char a[10][5] = {"hi", "hello", "fellows"};



  5.  printf("%s", a[2]);



  6.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  char a[10][5] = {"hi", "hello", "fellows"};



  5.  printf("%d", sizeof(a[1]));



  6.  }









Which of the following statements are true?


 P. Pointer to Array
Q. Multi-dimensional array
A program that has no command line arguments will have argc _________
What is the index of the last argument in command line arguments?
Which of the following is not possible in C?
How to call a function without using the function name to send parameters?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  int mul(int a, int b, int c)



  3.  {



  4.  return a * b * c;



  5.  }



  6.  void main()



  7.  {



  8.  int (*function_pointer)(int, int, int);



  9.  function_pointer = mul;



  10.  printf("The product of three numbers is:%d",



  11.  function_pointer(2, 3, 4));



  12.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void f(int (*x)(int));



  3.  int myfoo(int);



  4.  int (*fooptr)(int);



  5.  int ((*foo(int)))(int);



  6.  int main()



  7.  {



  8.  fooptr = foo(0);



  9.  fooptr(10);



  10.  }



  11.  int ((*foo(int i)))(int)



  12.  {



  13.  return myfoo;



  14.  }



  15.  int myfoo(int i)



  16.  {



  17.  printf("%d\n", i + 1);



  18.  }









Which of the following are themselves a collection of different data types?
User-defined data type can be derived by___________
Which operator connects the structure name to its member name?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  void main()



  3.  {



  4.  struct student



  5.  {



  6.  int no;



  7.  char name[20];



  8.  };



  9.  struct student s;



  10.  s.no = 8;



  11.  printf("%d", s.no);



  12.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  struct student



  3.  {



  4.  char *name;



  5.  };



  6.  struct student fun(void)



  7.  {



  8.  struct student s;



  9.  s.name = "alan";



  10.  return s;



  11.  }



  12.  void main()



  13.  {



  14.  struct student m = fun();



  15.  printf("%s", m.name);



  16.  }









Which of the following uses structure?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  struct student



  3.  {



  4.  };



  5.  void main()



  6.  {



  7.  struct student s[2];



  8.  printf("%d", sizeof(s));



  9.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  struct student



  3.  {



  4.  char *c;



  5.  };



  6.  void main()



  7.  {



  8.  struct student m;



  9.  struct student *s = &m;



  10.  (*s).c = "hello";



  11.  printf("%s", m.c);



  12.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  struct p



  3.  {



  4.  int x[2];



  5.  };



  6.  struct q



  7.  {



  8.  int *x;



  9.  };



  10.  int main()



  11.  {



  12.  struct p p1 = {1, 2};



  13.  struct q *ptr1;



  14.  ptr1->x = (struct q*)&p1.x;



  15.  printf("%d\n", ptr1->x[1]);



  16.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  struct student



  3.  {



  4.  char *c;



  5.  struct student *point;



  6.  };



  7.  void main()



  8.  {



  9.  struct student s;



  10.  struct student m;



  11.  m.point = s;



  12.  (m.point)->c = "hey";



  13.  printf("%s", s.c);



  14.  }









What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  struct student



  3.  {



  4.  char *c;



  5.  struct student point;



  6.  };



  7.  void main()



  8.  {



  9.  struct student s;



  10.  s.c = "hello";



  11.  printf("%s", s.c);



  12.  }









Which algorithm is used for searching in the table?
Which function is responsible for recording the name “s” and the replacement text “t” in a table?

What will be the output of the following C code?











  1.  #include <stdio.h>



  2.  struct student



  3.  {



  4.  char a[];



  5.  };



  6.  void main()



  7.  {



  8.  struct student s;



  9.  printf("%d", sizeof(struct student));



  10.  }









Be the first to comment

Leave a Reply