Sample Questions Best site for GRE, LSAT, SAT, GMAT, TOEFL, CCNA, CCSA and interview sample questions  

Technical Sample Questions : C |  C++ |  Oracle |  Java | Unix |  Operating Systems |  Data Structure

Sample Technical Questions

C Sample Question

  1. void main()
    {
    	unsigned giveit=-1;
    	int gotit;
    	printf("%u ",++giveit);
    	printf("%u \n",gotit=--giveit);
    }

    Answer:

    0 65535
  2. void main()
    {
    	int i;
    	char a[]="\0";
    	if(printf("%s\n",a))
    		printf("Ok here \n");
    	else
    		printf("Forget it\n");
    }

    Answer:

    Ok here

    Explanation:

    Printf will return how many characters does it print. Hence printing a null character returns 1 which makes the if statement true, thus "Ok here" is printed.
  3. void main()
    {
    	void *v;
    	int integer=2;
    	int *i=&integer;
    	v=i;
    	printf("%d",(int*)*v);
    }

    Answer:

    Compiler Error. We cannot apply indirection on type void*.

    Explanation:

    Void pointer is a generic pointer type. No pointer arithmetic can be done on it. Void pointers are normally used for,
    1. Passing generic pointers to functions and returning such pointers.
    2. As a intermediate pointer type.
    3. Used when the exact pointer type will be known at a later point of time.
  4. void main()
    {
    	int i=i++,j=j++,k=k++;
    printf("%d%d%d",i,j,k);
    }

    Answer:

    Garbage values.

    Explanation:

    An identifier is available to use in program code from the point of its declaration. So expressions such as i = i++ are valid statements. The i, j and k are automatic variables and so they contain some garbage value. Garbage in is garbage out (GIGO).
  5. void main()
    {
    	static int i=i++, j=j++, k=k++;
    printf("i = %d j = %d k = %d", i, j, k);
    }

    Answer:

    i = 1 j = 1 k = 1

    Explanation:

    Since static variables are initialized to zero by default.

« Previous || Next »

C Sample Question Number : 1-3 | 4-7 | 8-11 | 12-16 | 17-21 | 22-25 | 26-30 | 31-35 | 36-40 | 41-45 | 46-48 | 49-52 | 53-59 | 60-64 | 65-69 | 70-74 | 75-79 | 80-83 | 84-87 | 88-91 | 92-95 | 96-100 | 101-105 | 106-110 | 111-115 | 116-120 | 121-125 | 126-130 | 131-135 | 136-140 | 141-145 | 146-150

Sample Test Questions
GRE Sample Questions
CAT Sample Questions
GMAT Sample Questions
TOEFL Sample Questions
ACT Sample Questions
SAT Sample Questions
LSAT Sample Questions
PSAT Sample Questions
MCAT Sample Questions
PMP Sample Questions
GED Sample Questions
ECDL Sample Questions
DMV Sample Questions
CCNA Sample Questions
MCSE Sample Questions
Network+ Sample Questions
A+ Sample Questions
Technical Sample Questions
WASL Sample Questions
CISA Sample Questions

Other Sample Questions
Sample Interview Questions
Sample Teacher Interview Questions
Sample Citizenship Questions
Accuplacer Sample Questions
Science Bowl sample Questions
Driving Test Sample Questions
Sample Survey Questions Sample Essay Questions
Sample Behavioral Interview Questions

Copyright © 2004-2013, Best BSQ. All Rights Reserved.