1 c
2 b
3 a
On Sat, Aug 6, 2011 at 9:48 PM, i love programming <
[email protected]> wrote:
> Hello guys!
> Try finding answers for the MS test that happened in few colleges in
> Bangalore
> Here are the questions. Please post the answers.
>
> 1. Given a string s[1...n] and a reverse function reverse(s, i, k)
> which reverses the character sequence from i to k (inclusive of both)
> in string s, determine what the following operations result in.
> 1<k<n
>
> reverse(s, 1, k)
> reverse(s, k+1, n)
> reverse(s, 1, n)
>
> a) Reverses the string
> b) Rotates the String left k positions
> c) Rotates the String right k positions
> d) None of the above
>
>
> 2. If len is the length of the string and num is the number of
> characters printed on the screen
> Give the relation between num and len.
>
> void abc (char *s){
> if(s[0]=='\0')
> return;
>
> abc(s+1);
> abc(s+1);
> printf("%c ", s[0]);
> }
>
> a) num=2^len
> b )num=2^len-1
> c) num=2*len-1
> d) None of the above
>
>
> 3. Which of the following numbers cannot be represented accurately in
> binary?
> a) 0.1 b) 6.5 c) 1/16 d)1.32 e) 0.590625 (not sure abt option e)
>
> 1. a only
> 2. a and b
> 3. a, b and d
> 4. a, b and e
> (not sure about option 3)
>
> 4. A process doesn't require additional processors to carry out 40% of
> it's execution since 40% is mostly sequential. Determine how many
> additional processors are required to execute the process in 150s if
> the process takes 300s to execute on a single processor.
>
> a)5
> b)8
> c)6
> d)7
>
> 5. Time complexity of a function f(m) is O(m). If the array[i...n]
> contains either 1 or 0 in each of it's locations, determine the worst
> case time complexity of the following piece of code written in C-like
> language.
>
> counter=0;
> for(i=0; i=n; i++){
> if(a[i]==1)
> counter++;
> else{
> f(counter);
> counter=0;
> }
> }
>
> * i=n was given in the condition of for loop
>
> a) O(n^2)
> b) O(n^2 logn)
> c) O(nlogn)
> d) O(n)
>
> 6. Increasing the RAM increases the efficiency of the CPU. The reason
> is
> a) Virtual memory increases
> b) Number of page Page faults decreases
> c) Page segmentation decreases
> d) Increasing the amount of memory increases the speed of fetching
> data.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.