Search This Blog

Monday, June 8, 2009

C/C++ Test FAQ

This post is to collect all possible questions/answers that can be asked by an interviewer for software programming job.

7 comments:

  1. char c;
    c = 127; c += 10;
    c = ?
    a) c>0
    b) c<0 *
    c) c=0
    d) c>=0

    ReplyDelete
  2. int c = 0;
    if(c=(c!=1)){}
    c = ?
    a) 0
    b) 1 *
    c) true
    d) compiler error

    ReplyDelete
  3. char p[10][20][30];
    sizeof(p) = ?
    a) 1
    b) 10
    c) 600
    d) 6000 *

    ReplyDelete
  4. char *p = "Hello";
    sizeof(p) = ?
    a) 1
    b) 4 *
    c) 5
    d) 6

    ReplyDelete
  5. int i = 4;
    const int *p = &i;
    *p = 7;
    a)Compile time error *
    b)Run time error
    c)No error, works fine

    ReplyDelete
  6. int a, b;
    #define MAX(x,y) ((x)>(y))?(x):(y)
    a = 3;
    b = MAX(a++,3)
    a,b = ?
    a) 5, 4
    b) 5, 5
    c) 4, 3 *
    d) 3, 3

    ReplyDelete
  7. int i = 4;
    i = (i++) - (++i);
    i = ?
    a) -1
    b) 0
    c) 1*
    d) 2

    ReplyDelete