Home Company Questions Caritor Interview Questions Caritor Interview Questions - 2

Interview Dates

« < September 2010 > »
S M T W T F S
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 1 2
Subscribe to cyberqbank.com

Powered by
in.groups.yahoo.com

Login Form




Caritor Interview Questions - 2 Print E-mail

 

1.  #include <stdio.h>
          void main()
           {
             int **I;
             int *j=0;
             i=&j;
            if (NULL != i&& NULL != *i){
            printf("I am here");
            }
          }

a)prints I am here              b)does not print anything               c)compilaton error               d)runtime error

Ans: b

 

2.   #include<stdio.h>
               void func(int *x)
                 {
                     x=(int *) malloc(sizeof(int));
                     printf("in func: %p\n",x);
                }
                   void main(int argc)
             {
              int **pp;
              int *p;
              pp=(int **) malloc(sizeof(int *));
              p=(int *) malloc(sizeof((int));
              *pp=p;
              printf("first:%p \n",*pp);
              func(*pp);
             printf("last %p \n",*pp);
             }
assuming the p is equal to 1000 and x is equal to 2000 atfer malloc calls

a) 1000,2000,1000,                 b) 1000,2000,2000,              c) 1000,1000,1000               d) 2000,2000,2000

Ans: a

 

3. #include<stdio.h>
            void main(int argc)
            {
               int d=1234.5678;
              printf("%d",d);
            }

a) error,        b) 1234.5678,          c) 1234,          d) 1235

Ans: c

 

4. #include<stdio.h>
              void main()
                {
                   int a[2][2]={{2},{3}};
                  printf("%d",a[0][0]);
                  printf("%d",a[0][1]);
                  printf("%d",a[1][0]);
                  printf("%d",a[1][1]);
            }

a) 2300                b)2000               c)0030             d)2030

Ans: d

 

5.  #include<stdio.h>
              struct x
            {
             int i=0; /*line A*/
            };
           void main(int argc)
           {
            struct x y; /*line B*/
           }

a) error due to B,        b) no problem with option A and B,          c) error somewhere other than line A and B,          d) error due to line A

Ans: d

 

6. #include<stdio.h>
            void main(int argc)
            {
             int a[]={5,6};
            printf("%d",a[1.6]);
           }

a) 5,          b) runtime error     , c) compilation error,      d) 6

Ans: d

 

7.  #include<stdio.h>
            void main()
             {
               int *j=(int *)0x1000;
               printf("%p",j);
           }

a)prints-1000                b)runtime error                c)compilation error                d)none of the above

Ans: d

 

8. #include<stdio.h>
            void main(int argc)
               {
                char a[]={'1','2','3',0,'1','2','3'};
                printf(a);
                 }

a) compilation error    b) 123,     c) 123 123,    d) 1230123

Ans: b

 

9. #include<stdio.h>
               void main(int x)
                {
                  printf("%d",x) ;
                 }
if the name of the executable file is abc and the command line is given as abc xyz what is the output
       

a)compilation error          b)1           c)2          d)undefined

Ans: 2

 

10. #include<stdio.h>
             #define const const
             void main(int argc)
               {
                  const int x=0;
               }

a)  compilation error,     b)    runs fine,      c)     runtime error,    d)      none of   these

Ans: b

 

 

  No Comments.
Quick Post


Discuss this item on the forums. (0 posts)