Questions in Adobe Tests n Interviews – Part 6

Questions in Adobe Tests n Interviews – Part 6

Some more … 
Hope all these do help some of you people !!! 
———————————————-  

1) Reverse a link list using recursion.
2) Prove A+BC = (A+B)(A+C).
3) Write a function which round off a float to integer. Int round(float).
4) Given two number A & B, WAP to find, how many bits to be toggled to convert one number in another.
Ans: first find C=A XOR B. Now find no of set bits in C by C&(C-1).
5) Two sorted string A & B are given, which may have duplicates, find A-B, which contains only that element which are present in A not in B, also don’t have any duplicates.
6) Swap two integer pointers.
7) In a binary tree a node of degree two is that node which have two child, prove that if there are n Nodes of degree two in a binary tree than there will be exactly n+1 leaf.
Ans: I use mathematical induction.
8) A quad tree is in which a node can have maximum of 4 childs, find minimum height of a Quad tree where no of leaves are 341. Ans; I find 5
9) To simplify a Boolean expression. – Simple
10) You are provided with Accumulator and two other registers B &C and some set of instructions, Using those instruction and registers WAP in assembly language to find sum of 1-N.
11) How to dynamically allocate 2-D array having m rows and n cols.
12) A complicated expression was written in C, you need to explain that in one line.
13) Find whether a number is divisible by 3 without using divide or module operator, you can use itoa function.
14) You are provided a function to reverse a string from n1 to n2 index reverse(char * , int n1, int n2), using that fwrite a function to rotate a string by n.
Example: string: 1,2,3,4,5,6,7
After rotation by 3: 4,5,6,7,1,2,3
15) Find a binary tree is BST or not.
16) Find no. of leafs in a binary tree.
17) Insert a node in a sorted link list in the manner that resultant link list remain sorted.
18) A C code was given with switch case, where after each case no break was there, find the output for a particular case:
Ans: since no break statement is there so all the expressions get calculated for that case onwards.
19) A C code was written which was using Const char * const p; ..Exp…Need to correct that code,
Ans: I could not find any mistake.
20) An expression was written, to find its pre-order and post-order forms.
21) An array was given with duplicates in random, WAP to print that in right order.
Please see example: Given 5,12,,6,8,6,12,6,5,2 Output: 5,5,12,12,6,6,8,2

Here 12>6 but we will print 12 first because in original array 12 is before 6 for first time.

22) To number were given on base 13, need to find their difference.

————————————————————

Cheers,
Nikhil Pavan Kalyan