Placement Papers - Caritor

Caritor Solutions
CARITOR PAPER
Posted by :
Mamun
(9)
Some sample "c"     question from the paper:
     1) a null statement is a null pointer a)t b)f
     2)any fn written in c will return a value
     a)t b)f
     3) what is the o/p assuming a=3 b=4 c=5, a*=b+c;
     a) 26 b)17 c) 27 d)60
     4)to print a "%" char in printf string using
     a) % b) %+ c) %% d) none
     5) identify "c" keyword
     a) volatile b) default c)auto d)none
     6)does *p++ increment p?
     a)y b)n
     7)can c perform arithmetic on a void * pointer
     8)const char *p & char *const p are same
     a)t b)f
     9)to read one char at a time without waiting for RETURN key use
     a)gets() b)fgetc c)getch() d)cannot read
     
     10)char str1[]="hello";
     char str2[]="hello";
     the conditional string test (str1==str2)
     returns FALSE
     a)t b)f
     11) i had defined char a[6] in one source file and in another exten char     *a will it work
     a)t b)f
     12) char strbuf[]="hello ";
     char *strptr="world ";
     strbuf="world "; // _expression A
     strptr="hello"; //_expression B
     a) A invalid b) B invalid c)both valid d)both
     invalid
     
     13)for(loop=\'A\';loop<=\'z\';loop++)
     printf("%c",loop);
     above code will print
     a) A and Z b)A to Z c)error d)A to z char
     
     14)o/p of program
     int a=100;
     main()
     {
     int a=10;
     {
     int a=1;
     }
     printf("%d",a);
     a)100 b)10 c)1 d)unpredictable
     
     15)int i;
     char *str4="123four";
     i=atoi(str4);
     above statement will return
     a)123four
     b)123 c)1234 d)0
     
     ---------------------------------------------------------
     general aptitude
      verbal reasoning :9
     non verbal reasoning :5
     logical reasoning:1
     quantitative reasoning :15
     
     1)FORMULA:CONSTITUENT
     a) verdict:sentence
     b)rocket:pilot
     c)carburettor:mixture
     d)binomial:monocular
     e)equation:term
     
     2)A drove her car 30 km north turned left again and
     drove 40km.
     she then turned left and drove for 30 km .again she
     turned left and
     drove for 50 km .
     how faris she from initial position?
     a)10 b)50 c)30 d) none
     verbal ability(similar meaning)
     3)FINAL( )ULTIMATE
     a)last b)finish c)end d)dead
     4)BEAKER( ) CHALICE
     a)jug b)mug c)cup d)tube
     5)SHAPE( ) FORM
     A)appear b) design c) class d) group
     6) NICE ( ) PUNISH
     a)good b)fine c)clean d)time
     LOGICAL REASONING:
     5 FRIENDS L,K,M,N,RA,RO part time in a restaurent 5
     days a week
     1)n and r on mon,tue,wed
     2)ra and ro on mon,wed,thu
     3)r and l on mon ,fri,thu
     4)l and m on fri,tue and thu
     5)n and m on fri,tue,wed.
     
     a)which cannot work on thursday
     a)n b)ra c)ro d)l e)m
     
     similar qns...
     
     QUANTATIVE ABILITY
     
     1)A takes 4 days and B 5 days . both work together on same job, what     proportion of work is done by A ?
     
     2)in 4 yrs swami age would be double kesh. swami is twice as old as ramu.     which is true?
     a) s,k,r in ratio 6:1:3
     b)k is youngest of 3
     c)10 yrs hence will be 1/3k
     d)none
     
     3)no of ways in which team of 11 can be selected from 22 always     including 2 and excluding 4
     a 16c9 b)20c9 c)16c5 d)16c11
     
 4)when a 2 digit no is divided by the sum of digits the quotient is 4 . if digits are reversed new no is 6
     less than the original no. find the no.
     a)12 b)21 c)42 d)24
     
     5)conc of 3 wines a,b,c is 10,20,30% mixed in the ratio 2:3:x resulting     in a 23% conc soln. find x
     a)7 b) 5 c)6 d)4
     
 6)10 men have sufice ration for 3 meals a day for 5 days after 2 days 5 more men join, how many days it will
     last at rate of 2 meals.
     a)1 b)2 c)3 d)4
     
 7)the unit digits of a 3 digit no is square of hundred digit which of following can be diff between the no and no
     formed by reversing order of digits..
     a)200 c)196 b)198 d)194
     
     C QUESTIONS:
     
     1. Struct x
     {
     int i;
     char c;
     }
     
     union y{
     struct x a;
     double d;
     };
     
     printf("%d",sizeof(union y));
     
     a)8 ans:8
     b)5
     c)4
     d)1
     
     
     2. struct x{
     char c1;
     char c2;
     int i;
     short int j;
     };
     
     struct y{
     short int j;
     char c1;
     char c2;
     int i;
     };
     
     printf("%d %d",size of (struct x),size of (struct y));
     
     a)12 12
     b)8 8 ans:a
     c)12 8
     d)8 12
     
     
     3. enum x {a=1,b,c,d,f=60,y}
     printf("%d",y);
     a)5
     b)61
     c)6
     d)60
     ans:b
     
     4.
     #include<stdio.h>
     void main(){
     {
     # define x 10
     
     }
     printf("%d ",++x);
     }
     
     a)11
     b)10
     c)compile error ans:c
     d)runtime error
     
     5. #include<stdio.h>
     void main()
     {
     int k=2,j=3,p=0;
     p=(k,j,k);
     printf("%d ",p);
     
     }
     a)2
     b)error
     c)0
     d)3
     
     ans:a
     6. How to typedef a function pointer which takes int as a parameter
     and return an int
     a)Is not possible
     b)typedef int *funcptr int;
     c)typedef int * funcptr( int);
     d)typedef int (*funcptr)(int);
     ans:d
     
     7. #include<stdio.h>
     void main()
     {
     int k=10;
     k<<=1;
     printf("%d ",k);
     }
     a)10
     b)0
     c)20
     d)compilation error ans:c
     
     8. #include<stdio.h>
     void main()
     {
     int i=-10;
     for(;i;printf("%d ",i++));
     }
     a)error
     b)prints -10 to -1
     c)infinite loop
     d)does not print anything
     ans:b
     
     9.
     #include<stdio.h>
     void main()
     {
     int I=65,j=0;
     for(;j<26; i++,j++){
     printf("%s ", i);
     }
     }
     a)compilation Error
     b)prints A to Z
     c)prints a to z
     d)runtime error
     ans:b
     10.
     #include<stdio.h>
     void main()
     {
     unsigned int i=-1;
     printf("%d ",i);
     printf("%u ",i*-1);
     }
     
     a)runtime error
     b)compilation error
     c)prints -1 to 1
     d)prints 1 and 1
     ans:c
     11.
     #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
     12
     #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
     13
     #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
     
     14) #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
     
     15. #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
     
     16. #include<stdio.h>
     void func(int *x)
     {
     x=(int *) malloc(sizeof(int));
     printf("in func: %p ",x);
     }
     
     void main(int argc)
     {
     int **pp;
     int *p;
     pp=(int **) malloc(sizeof(int *));
     p=(int *) malloc(sizeof((int));
     *pp=p;
     printf("first:%p ",*pp);
     func(*pp);
     printf("last %p ",*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
     
     17. #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
     
     18. #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
     
     19. #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
     
     20. #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
     
     21. #include<stdio.h>
     void main(int arg c)
     {
     int x=1111;
     printf("%d",!x);
     }
     a.prints 1111
     b.compilation error
     c.prints 0
     d.is not a valid option
     ans:c
     22. struct {
     int len;
     char *str
     }*p;
     ++p -> len
     
     a.increments p
     b. increments len
     c.compilation error
     d.nothing happens with either of p and len
     ans:b
     23. int i=10;
     a.declaration
     b.definition
     c.both
     d.none
     ans:c
     
     24. #include<stdio.h>
     void main(int arg c)
     {
     char a[]=abcdefghijklmnopqrstuvwxyz;
     printf(%d,sizeof(a));
     }
     a.25 b.26 c.27 d.28
     ans:c
     25. #include<stdio.h>
     void main(int arg c)
     {
     char a[]=abcdefghijklmnopqrstuvwxyz;
     char *p=a;
     printf(%d,strlen(p));
     p+=10;
     printf(%d,strlen(a));
     }
     a.26 26
     b.26 16
     c.compilation error
     d.16 26
     ans:a
     
     26. if a file contains the IT solutions Inc.rn then on reading this
     line the array str using fgets() what would str contain?
     a. IT solutions Inc.
     b. IT solutions Inc.r0
     c. IT solutions Inc.rn0
     d. IT solutions Inc.n0
     
     27. if the following program (myprog)is run from the command line as
     myprog 1 2 3
     what would be the output?
     Main(int argc , char *argv[])
     {
     int I ,j=0;
     for (I=0;I<argc;I++)
     j=j+atoi(argv[i]);
     printf(%d.j);
     }
     
     a. 123 b.6 c.error d.123
     ans:6
     28. when pointers declared initialized to :
     a. null
     b.newly allocated memory
     c)nothing,its random
     d)none of the above
     ans:c
     
     29. what is the output of the following code?
     #include<stdio.h>
     void main()
     {
     printf("%d",printf(" hello world "));
     }
     
     a) 13, b) hello world 13, c) hello world, d) error
     ANS:b
     
     30. what is the output of the following code, assuming that the array
     begins at location 5364875?
     #include<stdio.h>
     void main()
     {
     int a[2][3][4]={
     {2,1,4,3,6,5,8,7,0,9,2,2}
     {1,2,3,4,5,6,7,8,9,0,1,2}
     };
     printf("%u %u %u %u",a,*a,**a,***a);
     }
     a) 5364875,5364876,5364877,5364878
     b) 5364875,5364876,5364877,2
     c) 5364875,5364875,5364876,5364876
     d) 5364875,5364875,5364875,2
     ANS:d
     31. are null statements in c null pointers.
     32. is cinst int *p same as int const* p
     find similar words
     beaker:chalice
     formulas:constituents
     time and work problem.