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. #include‹stdio.h›
    main()
     {
       const int i=4;
       float j;
       j = ++i;
       printf("%d  %f", i,++j);
     }

    Answer:

    Compiler error

    Explanation:

    i is a constant. you cannot change the value of constant
  2. #include‹stdio.h›
    main()
    {
      int a[2][2][2] = { {10,2,3,4}, {5,6,7,8}  };
      int *p,*q;
      p=&a[2][2][2];
      *q=***a;
      printf("%d..%d",*p,*q);
    }

    Answer:

    garbagevalue..1

    Explanation:

    p=&a[2][2][2] you declare only two 2D arrays. but you are trying to access the third 2D(which you are not declared) it will print garbage values. *q=***a starting address of a is assigned integer pointer. now q is pointing to starting address of a.if you print *q meAnswer:it will print first element of 3D array.
  3. #include‹stdio.h›
    main()
      {
        register i=5;
        char j[]= "hello";                     
         printf("%s  %d",j,i);
    }

    Answer:

    hello 5

    Explanation:

    if you declare i as register compiler will treat it as ordinary integer and it will take integer value. i value may be stored either in register or in memory.
  4. main()
    {
    	  int i=5,j=6,z;
    	  printf("%d",i+++j);
    	 }

    Answer:

    11

    Explanation:

    the expression i+++j is treated as (i++ + j)
  5. struct aaa{
    struct aaa *prev;
    int i;
    struct aaa *next;
    };
    main()
    {
     struct aaa abc,def,ghi,jkl;
     int x=100;
     abc.i=0;abc.prev=&jkl;
     abc.next=&def;
     def.i=1;def.prev=&abc;def.next=&ghi;
     ghi.i=2;ghi.prev=&def;
     ghi.next=&jkl;
     jkl.i=3;jkl.prev=&ghi;jkl.next=&abc;
     x=abc.next->next->prev->next->i;
     printf("%d",x);
    }

    Answer:

    2

    Explanation:

    above all statements form a double circular linked list;
    abc.next->next->prev->next->i
    this one points to "ghi" node the value of at particular node is 2.

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