Sei sulla pagina 1di 34

8/31/2018 Six Phrase - mySlate

TCS NINJA ADVANCED MCQs


Test Summary
No. of Sections: 1
No. of Questions: 77
Total Duration: 10 min

Section 1 - Advanced Programming Logic

Section Summary
No. of Questions: 77
Duration: 10 min

Additional Instructions:
None

Q1. An important property of an iterative algorithm is the rate of convergence of the


iterates to the answer. For some root nding methods, the convergence is linear
(the error after an iteration is proportional to the present error) and in others, it is
quadratic (the error after an iteration is approximately proportional to the square of
the present error). After an algorithm was run, the error after the different iterations
was observed to be 0.5, 0.25, 0.1, 0.03. After how many more iterations will the
answer be accurate to 4 decimal places

12 

Q2. A telephone exchange offers a directory service. A person calls a number, and
speaks the name of the party to the operator. The operator then types the name
she heard into the computer. Here, it is converted into a “phoneme”, where two
names that sound the same, but spelt differently (Gupta and Gooptha) are
identical. This phoneme is used to access a disk data structure with a relatively
slow disk, and no cache in the disk.. The telephone exchange is in a large city with
over a crore entries. The disk will be accessed until all the names with the same
phoneme are retrieved, and the additional details (address, locality) used to identify
the correct person an get the appropriate phone number. What is the best data
structure for storing the phonemes and associated data in the disk?
https://myslate.sixphrase.com/ 1/34
8/31/2018 Six Phrase - mySlate

Balanced Tree

Doubly Linked List

Hash Structure 

Q3. The Tower of Hanoi game consists of three pegs (towers) – A,B,C with n disks
placed one over the other on peg A such that the disks are arranged in decreasing
diameter from bottom to top. The objective of the game is to move the stack of
disks from peg A to peg C following these simple rules: 1) Only one disk can be
moved at a time. 2) Each move consists of taking the upper disk from one of the
stacks and placing it on top of another stack or on an empty rod. 3) For temporary
storage, peg B may be used 4) No disk may be placed on top of a smaller disk.
Eesha tried to manually carryout re-ordering of 14 disks using the above rules. She
rst worked out the strategy to make the minimum number of moves, and then
carried this out. She made 1 move per second and spent exactly 1 hour per day in
arranging disks. She started her rst move on a Monday. On which day did she
nish the game ?

Wedneday

Friday 

Monday

Q4. Consider the usual algorithm for determining whether a sequence of parentheses
is balanced. The maximum number of parentheses that appear on the stack AT
ANY ONE TIME when the algorithm analyzes: (()(())(())) are:

https://myslate.sixphrase.com/ 2/34
8/31/2018 Six Phrase - mySlate

3 

Q5. A sort algorithm, when sorting in ascending order will obviously put items with
lower keys before items with higher keys. How it treats items with equal keys
de nes an important property. A sort algorithm is said to be stable if two items
with equal keys will be guaranteed to come out n the output sequence in the same
order as in the input. An algorithm is said to be of time complexity O(f(n)), where
f(n) is a function of n, if, for large values of n, the number of operations to execute
it is proportional to f(n). A bubble sort is a sort algorithm that keeps exchanging
adjacent items if they are in the wrong order.Consider the following statements: A
The bubble sort is stable. B The bubble sort has time complexity O(n log n), in the
worst case (input is sorted in the reverse order)

A is true, B is false 

A is false, B is true

A is true, B is true

Q6. What is the output of the following code?

Compilation error

Some grabage value 

https://myslate.sixphrase.com/ 3/34
8/31/2018 Six Phrase - mySlate

Unde ned behavior

Q7. Given an array arr = {5,6,77,88,99} and key = 88; How many iterations are done until
the element is found?

2 

Q8. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a
time, in what order will they be removed?

ABCD 

DCBA

DCAB

ABDC

Q9. Consider the usual algorithm for determining whether a sequence of parentheses
is balanced. Suppose that you run the algorithm on a sequence that contains 2 left
parentheses and 3 right parentheses (in some order). The maximum number of
parentheses that appear on the stack AT ANY ONE TIME during the computation?

2 

https://myslate.sixphrase.com/ 4/34
8/31/2018 Six Phrase - mySlate

4 or more

Q10. What is the average case complexity of bubble sort?

O(nlogn)

O(logn)

O(n)

O(n2) 

Q11. What is the output of the following code?

0.100000, junk value

Junk value, 0.100000 

0, 0.100000

0, 0.999999

Q12. Given an array arr = {45,77,89,90,94,99,100} and key = 100; What are the mid
values(corresponding array elements) generated in the rst and second iterations?

https://myslate.sixphrase.com/ 5/34
8/31/2018 Six Phrase - mySlate

90 and 99 

90 and 100

89 and 94

94 and 99

Q13. A normal queue, if implemented using an array of size MAX_SIZE, gets full when

Rear = MAX_SIZE – 1 

Front = (rear + 1)mod MAX_SIZE

Front = rear + 1

Rear = front

Q14. What is the value of the post x expression 6 3 2 4 + – *:

Something between -5 and -15

Something between 5 and -5

Something between 5 and 15

Something between 15 and 100 

Q15. The given array is arr = {1,2,4,3}. Bubble sort is used to sort the array elements.
How many iterations will be done to sort the array with improvised version?

https://myslate.sixphrase.com/ 6/34
8/31/2018 Six Phrase - mySlate

2 

Q16. Which of the following type-casting have chances for wrap around?

int to char 

int to oat

char to short

char to int

Q17. What does the following piece of code do?

Print the duplicate elements in an array 

Print the element with maximum frequency

Print the unique elements in the array

None of the above

https://myslate.sixphrase.com/ 7/34
8/31/2018 Six Phrase - mySlate

Q18. Convert the following in x expressions into its equivalent post x expressions (A +
B ⋀D)/(E – F)+G

(A B D +⋀ E F – / G +)

(A B D ⋀ + E F/- G +)

(A B D ⋀ + E F – / G +) 

None of the above

Q19. Here is an in x expression: 4 + 3*(6*3-12). Suppose that we are using the usual
stack algorithm to convert the expression from in x to post x notation. The
maximum number of symbols that will appear on the stack AT ONE TIME during
the conversion of this expression?

4 

Q20. What is the advantage of bubble sort over other sorting techniques?

It is faster

Consumes lesser memory

Detects whether the input is already sorted 

All of the above

https://myslate.sixphrase.com/ 8/34
8/31/2018 Six Phrase - mySlate

Q21. What is the worst case complexity of bubble sort?

O(nlogn)

O(logn)

O(n)

O(n2) 

Q22. The post x form of A*B+C/D is?

*AB/CD+

AB*CD/+ 

A*BC+/D

ABCD+/*

Q23. Assume that the operators +,-, X are left associative and ^ is right associative. The
order of precedence (from highest to lowest) is ^, X, +, -. The post x expression for
the in x expression a + b X c – d ^ e ^ f is

abc X+ def ^^ – 

abc X+ de^f^ –

ab+c Xd – e ^f^

-+aXbc^ ^def

Q24. What does the following piece of code do?

https://myslate.sixphrase.com/ 9/34
8/31/2018 Six Phrase - mySlate

Preorder traversal 

Inorder traversal

Postorder traversal

Level order traversal

Q25. Which of the following typecasting is accepted by C?

Widening conversions

Narrowing conversions

Widening and narrowing conversions 

None of the above

Q26. What will be the output of the program (myprog.c) given below if it is executed
from the command line?

cmd> myprog one two three

/* myprog.c */
#include<stdio.h>

int main(int argc, char **argv)


{
  printf("%c", **++argv);
  return 0;
}

https://myslate.sixphrase.com/ 10/34
8/31/2018 Six Phrase - mySlate

myprog one two three

myprog one

o 

two

Q27. What is the time complexity of inserting a node in a doubly linked list?

 O(nlogn)

O(logn)

 O(n) 

 O(1)

Q28. What is the functionality of the following code?


public void function(Node node)
{
if(size == 0)
head = node;
else
{
Node temp,cur;
for(cur = head; (temp = cur.getNext())!=null; cur = temp);
cur.setNext(node);
}
size++;
}

Inserting a node at the beginning of the list

Deleting a node at the beginning of the list

https://myslate.sixphrase.com/ 11/34
8/31/2018 Six Phrase - mySlate

Inserting a node at the end of the list 

Deleting a node at the end of the list

Q29. Which of the following best describe volatile keyword?

Volatile keyword indicates that the variable is


stored in volatile memory

Volatile keyword indicates that the value of


the variable cannot be determined at compile
time

Volatile keyword instruct the compiler not to 


do any optimization on that variable

Volatile keyword indicates that it cannot be


used with const keyword

Q30. Suppose we have numbers between 1 and 1000 in a binary search tree and want to
search for the number 363. Which of the following sequence could not be the
sequence of the node examined?

2, 252, 401, 398, 330, 344, 397, 363

924, 220, 911, 244, 898, 258, 362, 363

925, 202, 911, 240, 912, 245, 258, 363 

2, 399, 387, 219, 266, 382, 381, 278, 363

Q31. What does the following function check for? (all necessary headers to be included
and function is called from main)

  #de ne MAX 10
 
  typedef struct stack
https://myslate.sixphrase.com/ 12/34
8/31/2018 Six Phrase - mySlate

  {
    int top;
int item[MAX];
  }stack;
 
  int function(stack *s)
  {
    if(s->top == -1)
  return 1;
else return 0;
  }

full stack

invalid index

 empty stack 

in nite stack

Q32. The maximum combined length of the command-line arguments including the
spaces between adjacent arguments is

 128 characters

256 characters

67 characters

It may vary from one operating system to 


another

Q33. What is the time complexity of inserting at the end in dynamic arrays?

O(1)

O(n)

https://myslate.sixphrase.com/ 13/34
8/31/2018 Six Phrase - mySlate

O(logn)

Either O(1) or O(n) 

Q34. Which of the following is TRUE about argv?

It is an array of character pointers 

It is a pointer to an array of character pointers

It is an array of strings

None of above

Q35. According to ANSI speci cations which is the correct way of declaring main when
it receives command-line arguments?

int main(int argc, char *argv[]) 

int main(argc, argv)


  int argc; char *argv;

int main()
{
  int argc; char *argv;
}

None of above

Q36. What is the functionality of the following piece of code?

public int function(int data)


{
Node temp = head;
int var = 0;
while(temp != null)
{
https://myslate.sixphrase.com/ 14/34
8/31/2018 Six Phrase - mySlate

if(temp.getData() == data)
{
return var;
}
var = var+1;
temp = temp.getNext();
}
return Integer.MIN_VALUE;
}

Find and delete a given element in the list

Find and return the given element in the list

Find and return the position of the given 


element in the list

Find and insert a new element in the list

Q37. Consider the following C program

int main() 

  int x, y, m, n; 
  scanf ("%d %d", &x, &y); 
  /* x > 0 and y > 0 */
  m = x; n = y; 
  while (m != n) 
  { 
   if(m>n) 
     m = m - n; 
   else
     n = n - m; 
  } 
  printf("%d", n); 
}

What does the program compute?

x + y using repeated subtraction

x mod y using repeated subtraction

https://myslate.sixphrase.com/ 15/34
8/31/2018 Six Phrase - mySlate

the greatest common divisor of x and y 

the least common multiple of x and y

Q38. In full binary search tree every internal node has exactly two children. If there are
100 leaf nodes in the tree, how many internal nodes are there in the tree?

99 

25

49

101

Q39. Consider these functions:


push() : push an element into the stack
pop() : pop the top-of-the-stack element
top() : returns the item stored in top-of-the-stack-node
What will be the output after performing these sequence of operations

push(20);
push(4);
top();
pop();
pop();
pop();
push(5);
top();

20

stack under ow

5 

https://myslate.sixphrase.com/ 16/34
8/31/2018 Six Phrase - mySlate

Q40. What is the time complexity to count the number of elements in the linked list?

O(1)

O(n) 

 O(logn)

None of the mentioned

Q41. What will be the output of the program (myprog.c) given below if it is executed
from the command line?

cmd> myprog one two three

/* myprog.c */
#include<stdio.h>
#include<stdlib.h>

int main(int argc, char **argv)


{
  printf("%s", *++argv);
  return 0;
}

myprog

one 

two

three

Q42. Which of the following statements are FALSE about the below code?
int main(int ac, char *av[])
{
}

https://myslate.sixphrase.com/ 17/34
8/31/2018 Six Phrase - mySlate

ac contains count of arguments supplied at


command-line

av[] contains addresses of arguments


supplied at a command line

In place of ac and av, argc and argv should be 


used.

The variables ac and av are always local to


main()

Q43. Consider the following doubly linked list: head-1-2-3-4-5-tail


What will be the list after performing the given sequence of operations?

Node temp = new Node(6,head,head.getNext());


Node temp1 = new Node(0,tail.getPrev(),tail);
head.setNext(temp);
temp.getNext().setPrev(temp);
tail.setPrev(temp1);
temp1.getPrev().setNext(temp1);

head-0-1-2-3-4-5-6-tail

head-1-2-3-4-5-6-tail

head-6-1-2-3-4-5-0-tail 

head-0-1-2-3-4-5-tail

Q44. Which of the following statement are correct?

(i) The value stored in the CPU register can always be accessed faster than that
stored in memory.
(ii) A register storage class variable will always be stored in a CPU register. 

Only I is correct  

https://myslate.sixphrase.com/ 18/34
8/31/2018 Six Phrase - mySlate

Only II is correct

Both I & II are correct

Both I & II are incorrect

Q45. A binary search tree is generated by inserting in order the following integers:
50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24

The number of the node in the left sub-tree and right sub-tree of the root,
respectively, is

(4, 7)

(7, 4) 

(8, 3)

(3, 8)

Q46. What does the following piece of code do?


 function()
{
if(isEmpty())
return -999;
else
{
int high;
high = q[front];
return high;
}
}

Dequeue

enqueue

https://myslate.sixphrase.com/ 19/34
8/31/2018 Six Phrase - mySlate

Return the front element 

None of the mentioned

Q47. What is the space complexity for deleting a linked list?

 O(1) 

O(n)

 Either O(1) or O(n)

O(logn)

Q48. In the worst case, the number of comparisons needed to search a singly linked list
of length n for a given element is

log 2 n

n/2

log 2 n – 1

n 

Q49. What is the time complexity of pop() operation when the stack is implemented
using an array?

O(1) 

O(n)

https://myslate.sixphrase.com/ 20/34
8/31/2018 Six Phrase - mySlate

O(logn)

O(nlogn)

Q50. What will be the output of the program (sample.c) given below if it is executed from
the command line (Turbo C in DOS)?
cmd> sample 1 2 3
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])


{
  int j;
  j = argv[1] + argv[2] + argv[3];
  printf("%d", j);
  return 0;
}

Error 

sample 6

Garbage value

Q51. What will be the output of the program (sample.c) given below if it is executed from
the command line (turbo c under DOS)?
cmd> sample Good Morning
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])


{
  printf("%d %s", argc, argv[1]);
  return 0;
}

 3 Good 

https://myslate.sixphrase.com/ 21/34
8/31/2018 Six Phrase - mySlate

2 Good

Good Morning

3 Morning

Q52. What will be the output of the program


#include<stdio.h>
void fun(int);

int main(int argc)


{
  printf("%d", argc);
  fun(argc);
  return 0;
}
void fun(int i)
{
  if(i!=4)
    main(++i);
}

123

1234 

234

Q53. What will be the output of the program (sample.c) given below if it is executed from
the command line?
cmd> sample "*.c"
/* sample.c */
#include<stdio.h>

int main(int argc, int *argv)


{
  int i;
  for(i=1; i<argc; i++)
    printf("%s", argv[i]);
  return 0;
}
https://myslate.sixphrase.com/ 22/34
8/31/2018 Six Phrase - mySlate

*.c 

 "*.c"

sample *.c

List of all les and folders in the current


directory

Q54. What will be the output of the program (sample.c) given below if it is executed from
the command line?
cmd> sample friday tuesday sunday
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])


{
  printf("%c", **++argv);
  return 0;
}

f 

sample

friday

Q55. What will be the output of the program if it is executed like below?
cmd> sample
/* sample.c */
#include<stdio.h>

int main(int argc, char **argv)


{
  printf("%s", argv[argc-1]);
  return 0;
}

https://myslate.sixphrase.com/ 23/34
8/31/2018 Six Phrase - mySlate

sample 

samp

no output

Q56. cmd> myprog friday tuesday sunday


/* myprog.c */
#include<stdio.h>

int main(int argc, char *argv[])


{
  printf("%c", *++argv[1]);
  return 0;
}

r 

Q57. What will be the output of the program (sample.c) given below if it is executed from
the command line?
cmd> sample one two three
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])


{
  int i=0;
  i+=strlen(argv[1]);
  while(i>0)
  {
    printf("%c", argv[1][--i]);
  }
  return 0;

https://myslate.sixphrase.com/ 24/34
8/31/2018 Six Phrase - mySlate

three two one

owt

eno 

eerht

Q58. What will be the output of the program (sample.c) given below if it is executed from
the command line?
cmd> sample 1 2 3
cmd> sample 2 2 3
cmd> sample 3 2 3
/* sample.c */
#include<stdio.h>

int main(int argc, char *argv[])


{
  printf("%s", argv[0]);
  return 0;
}

sample 3 2 3

sample 1 2 3

 sample 

Error

Q59. Suppose you are provided with the following function declaration in the C
programming language.

  int partition (int a[], int n); 


The function treats the rst element of a[] as a pivot, and rearranges the array so
that all elements less than or equal to the pivot is in the left part of the array, and all
elements greater than the pivot is in the right part. In addition, it moves the pivot so
that the pivot is the last element of the left part. The return value is the number of
elements in the left part. The following partially given function in the C
https://myslate.sixphrase.com/ 25/34
8/31/2018 Six Phrase - mySlate

programming language is used to nd the kth smallest element in an array a[ ] of


size n using the partition function. We assume k = n

int kth_smallest (int a[], int n, int k)


{
  int left_end = partition (a, n);
  if (left_end+1==k)
  {
    return a [left_end];
  }
  if (left_end+1 > k)
  {
   return kth_smallest (____________________);
  }
  else
  {
   return kth_smallest (____________________);
  }
}
The missing argument lists are respectively

(a, left_end, k) and (a+left_end+1, n–left_end– 


1, k–left_end–1)

 (a, left_end, k) and (a, n–left_end–1, k–


left_end–1)

 (a, left_end+1, N–left_end–1, K–left_end–1)


and(a, left_end, k)

(a, n–left_end–1, k–left_end–1) and (a,


left_end, k)

Q60. What is the functionality of the following piece of code?

public int function()


{
Node temp = tail.getPrev();
tail.setPrev(temp.getPrev());
temp.getPrev().setNext(tail);
size--;
return temp.getItem();
}

https://myslate.sixphrase.com/ 26/34
8/31/2018 Six Phrase - mySlate

Return the element at the tail of the list but do


not remove it

Return the element at the tail of the list and 


remove it from the list

 Return the last but one element from the list


but do not remove it

Return the last but one element at the tail of


the list and remove it from the list

Q61. Consider the following doubly linked list: head-1-2-3-4-5-tail


What will be the list after performing the given sequence of operations?

Node temp = new Node(6,head,head.getNext());


head.setNext(temp);
temp.getNext().setPrev(temp);
Node temp1 = tail.getPrev();
tail.setPrev(temp1.getPrev());
temp1.getPrev().setNext(tail);

head-6-1-2-3-4-5-tail

 head-6-1-2-3-4-tail 

head-1-2-3-4-5-6-tail

head-1-2-3-4-5-tail

Q62.  What is the functionality of the following piece of code?

public int function(int data)


{
Node temp = head;
int var = 0;
while(temp != null)
{
if(temp.getData() == data)
{
return var;

https://myslate.sixphrase.com/ 27/34
8/31/2018 Six Phrase - mySlate

}
var = var+1;
temp = temp.getNext();
}
return Integer.MIN_VALUE;
}

Find and delete a given element in the list

Find and return the given element in the list

Find and return the position of the given 


element in the list

Find and insert a new element in the list

Q63. The following C function takes a single-linked list of integers as a parameter and
rearranges the elements of the list.
The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, 7 in the
given order. What will be the contents of the list after the function completes
execution?

struct node 
{
  int value;
  struct node *next;
};
void rearrange(struct node *list)
{
  struct node *p, * q;
  int temp;
  if ((!list) || !list->next) 
   return;
  p = list;
  q = list->next;
  while(q) 
  {
     temp = p->value;
     p->value = q->value;
     q->value = temp;
     p = q->next;
     q = p?p->next:0;
  }
}

https://myslate.sixphrase.com/ 28/34
8/31/2018 Six Phrase - mySlate

1, 2, 3, 4, 5, 6, 7

2, 1, 4, 3, 6, 5, 7 

1, 3, 2, 5, 4, 7, 6

2, 3, 4, 5, 6, 7, 1

Q64. You are given pointers to rst and last nodes of a singly linked list, which of the
following operations are dependent on the length of the linked list?

Delete the rst element

Insert a new element as a rst element

Delete the last element of the list 

Add a new element at the end of the list

Q65. What does the following function do for a given Linked List with rst node as head?

void fun1(struct node* head)


{
  if(head == NULL)
  return;
  fun1(head->next);
  printf("%d ", head->data);
}

Prints all nodes of linked lists

 Prints all nodes of linked list in reverse order 

Prints alternate nodes of Linked List

https://myslate.sixphrase.com/ 29/34
8/31/2018 Six Phrase - mySlate

Prints alternate nodes in reverse order

Q66. struct item


{
int data;
struct item * next;
};
int f (struct item *p)
{
return((p==NULL) ||((p->next==NULL)||(p->data<=p->next->data) && (p->next)));
}

For a given linked list p, the function f returns 1 if and only if

the list is empty or has exactly one element

the element in the list are sorted in non- 


decreasing order of data value

the element in the list are sorted in non-


increasing order of data value

not all element in the list have the same data


value

Q67. Consider the function f de ned below.

struct item 

 int data; 
 struct item * next; 
}; 
 
int f(struct item *p) 

 return (
     (p == NULL) || 
     (p->next == NULL) || 
     (( P->data <= p->next->data) && f(p->next))
     ); 

For a given linked list p, the function f returns 1 if and only if

https://myslate.sixphrase.com/ 30/34
8/31/2018 Six Phrase - mySlate

the list is empty or has exactly one element

the elements in the list are sorted in non- 


decreasing order of data value

the elements in the list are sorted in non-


increasing order of data value

not all elements in the list have the same data


value.

Q68. In a singly linked list, each node has a pointer to the next node in the list. The last
node points to nothing.Eesha wrote an iterative function that takes the rst node of
a singly linked list as argument, reverses the list, and returns the rst node from the
resulting list.However, she did not get the correct result. The pseudo code for this
function is given below. In which line number has she made a mistake? _________

Q69. A non-decreasing sub-sequence of a sequence is a sub-sequence in which each


number is not less than the previous one. For example, for the sequence 5, 1, 3, 2, 8
some of the non-decreasing sub-sequences are: 5, 8 1, 2, 8 Find the length of the
longest non-decreasing sub-sequence of 548, 678, 776, 587, 970, 680, 278, 122,
947, 457, 797, 503, 660, 892, 254, 276. _________

Q70. Consider the following de nition in c programming language.                                 


struct node

   int data;

   struct node * next;

typedef struct node NODE;


https://myslate.sixphrase.com/ 31/34
8/31/2018 Six Phrase - mySlate

NODE *ptr;

Write the code to add a newnode. _________

Q71. Four matrices M1, M2, M3 and M4 of dimensions pxq, qxr, rxs and sxt respectively
can be multiplied is several ways with different number of total scalar
multiplications. For example, when multiplied as ((M1 X M2) X (M3 X M4)), the
total number of multiplications is pqr + rst + prt. When multiplied as (((M1 X M2) X
M3) X M4), the total number of scalar multiplications is pqr + prs + pst.If p = 10, q =
100, r = 20, s = 5 and t = 80, then the number of scalar multiplications needed is:
_________

Q72. Write the missing statement

_________

Q73. Consider two strings A = "qpqrr" and B = "pqprqrp". Let x be the length of the
longest common subsequence (not necessarily contiguous) between A and B and
let y be the number of such longest common subsequences between A and B.
Then x + 10y = _________ .

Q74. What is the output of following function for start pointing to rst node of following
linked list?

_________
https://myslate.sixphrase.com/ 32/34
8/31/2018 Six Phrase - mySlate

Q75. Let A1, A2, A3, and A4 be four matrices of dimensions 10 x 5, 5 x 20, 20 x 10, and
10 x 5, respectively. The minimum number of scalar multiplications required to nd
the product A1A2A3A4 using the basic matrix multiplication method is  _________

Q76. The following C function takes a simply-linked list as input argument.It modi es the
list by moving the last element to the front of the list and returns the modi ed list.
Some part of the code is left blank. _________ .

Q77. #include<stdio.h>

int bo(int n)

     if(n<=1)

 return n;

     return bo(n-1) + bo(n-2);

int main()

{  

     int r = bo(50000);

     printf("%d",r);

https://myslate.sixphrase.com/ 33/34
8/31/2018 Six Phrase - mySlate

     return 0;

}
_________

https://myslate.sixphrase.com/ 34/34

Potrebbero piacerti anche