AMCAT Coding Ability Sample Question For You
Q1. In marathon , The Time Keeper need To Save Its Record In which Data Type In Coding ?
a) Double b) Floating c) Integer d) Pointer
Ans. A. Because double store data with high precision.
Q2. Predict The Output int a=1202 ,b,c,d=10;b=a/d; c=a-b; Print c ?
a)1080 b)1080.8 c)120.2 d) None
Ans. A
Q3. which of the following is defined to do the same action again and again automatically taking the value by calling itself till it match exit condition?
a) For b) Recursion c) Do-while d) Switch
Ans. B . Recursion calls itself.
Q4. Answer coding Output #include int res(int x) { if(x==4) return n; else 2*res(x+1); } int main(){ printf(“%d”,res(2)) ; return 0; }?
a) 2 b) 32 c) 8 d) 16
Ans. D.
Q.5 Find The OutPut Of The Following # include int p=7,q,r; p=q=20; r=p<100; printf(“%d %d %d”,p,q,r) ?
a) 20:20:0 b) 20:20:1 c) 20:20:100 d) 7:20:100
Ans. B.
Q6. Predict The Output int x=99 ; x++; printf(“%d %d %d %d”, –x,x–,x++,x-4); ?
a) 99 99 98 95 b)99 98 99 95 c) 100 99 98 93 d)none
Ans.A.
Q7. Answer the coding result -> #include<stdio.h> extern int me; void main(){ me=100; printf(“%d”,me); }
a) 100 b) 0 c) Compiler Error d) Syntax Error
Ans. C. Extern is responsible for defining not for allocation of memory.
Q8.Ram is 5 years old and having DSA book and He Decide to Color Each Node With Different Color ,So How Mnay Total Node Are There?
a) 27 b) 57 c) 31 d) None
Ans. B. Method For Each Level is 2^n – 1, where n is level so for 1 level 1 node , for 2 level 3, For 3 level 7, For 4 level 15 and for 5 level 31 so total is 57
Q9.Which Statment Represent Dynamic Allocation Of Array ?
a)Allocation that place as bipartite Graph b)Allocation that takes place compiler time c) allocation that take place at run time rendering the resizing of array d) All of the Above
Ans. C
Q10. Select Two Correct Statement about Abstract Class?
a) Object Can’t Be Created b) It Can’t create Reference To Abstract Class c) Can’t Create Pointer To Abstract Function d) It Contain At Least one Pure Virtual Function.
Ans. A and D.