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. int i,j;


    Runtime error: Abnormal program termination.
    assert failed (i<5), ‹file name›,‹line number›

    Explanation: asserts are used during debugging to make sure that certain conditions are satisfied. If assertion fails, the program will terminate reporting the same.

    After debugging use,

    #undef NDEBUG

    and this will disable all the assertions from the source code. Assertion is a good debugging tool to make use of.

  2. main()
    	int i=-1;
    	printf("i = %d, +i = %d \n",i,+i);


    i = -1, +i = -1


    Unary + is the only dummy operator in C. Where-ever it comes you can just ignore it just because it has no effect in the expressions (hence the name dummy operator).
  3. What are the files which are automatically opened when a C file is executed?

    Answer: stdin, stdout, stderr (standard input,standard output,standard error).

  4. what will be the position of the file marker?
    a: fseek(ptr,0,SEEK_SET);
    b: fseek(ptr,0,SEEK_CUR);

    Answer :

    a: The SEEK_SET sets the file position marker to the starting of the file.
    b: The SEEK_CUR sets the file position marker to the current position of the file.
  5. main()
    	char name[10],s[12];
    	scanf(" \"%[^\"]\"",s);

    How scanf will execute?


    First it checks for the leading white space and discards it.Then it matches with a quotation mark and then it reads all character upto another quotation mark.
  6. What is the problem with the following code segment?
    while ((fgets(receiving array,50,file_ptr)) != EOF);

    Answer & Explanation:

    fgets returns a pointer. So the correct end of file check is checking for != NULL.
  7. main()


    Runtime error : Stack overflow.


    main function calls itself again and again. Each time the function is called its return address is stored in the call stack. Since there is no condition to terminate the function call, the call stack overflows at runtime. So it terminates the program and results in an error.

« 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.