Computer Programming Sample Questions

Published on February 2017 | Categories: Documents | Downloads: 30 | Comments: 0 | Views: 225
of 2
Download PDF   Embed   Report

Comments

Content

 

Computer Programming Sample Questions questionStatement

answerA

answerB

answerC

answerD

0<br/>0 3

0 3<br/>0 36

0<br/>0 3 6<br/>0 369

0 3 6<br/>0 3 6 9<br/>0 3 6 9 12

80 lower bound Degree of each vertex in the graph

40

Shravanti writes the following program: integer i = 0, j while ( i < 2 )  j{ = 0; while ( j <= 3*i ) print j print <i>blank space</i>  j = j + 3 } print \takes the cursor to the next line i=i+1 What will be the output of the program? Consider the following code:function modify(a,b) integer c, d=2 c = a*d + b return c function calculate( ) integer a = 5, b = 20, c integer d = 10 c = modify(a, b); c=c+d print c Assume that a and b were passed by value. What will be the output of the function calculate( ) ? Smallest element of an array's index is called its

range

32 upper bound

72 extraction

Degree of each vertex in the graph

The graph should have

The graph should

For a path to be Eulerian, which of the following conditions are necessary and sufficient? A hash table can store a maximum of 10 records. Currently there are records in locations 1, 3, 4, 7, 8, 9, 10. The probability of a new record going into location 2, with a hash function resolving collisions by linear probing is

should be even.

should be odd.

even edges.

have odd edges.

0.6

0.1

0.5

We have a max heap with n elements. We insert an element which is larger than all elements in the heap. Where will it be inserted?

Top of the heap

Bottom of the heap

0.2 Some where in between the heap.

Cannot be determined

answerE

 

A list is implemented as a singly linked link-list. The address of the first and last node are a re stored in variables <i>first</i> and <i>last</i>. Given the address of a node is given in the variable <i>node</i>, the element stored in the node can be accessed by the statement <i>node->data</i> and the address to the next node can be accessed by <i>node>next</i>. Yusuf writes the code to delete the first element from the linked-list. He writes the following function, where first and last are passed by reference. function deleteElement(first, last) if (first isequal null { print "List empty" } else { first = first->next } } In which of the following scenarios will the code not work properly? Q is an empty queue. The following operations are done on it: ADD 5 ADD 7 ADD 46 DELETE ADD 13 DELETE DELETE ADD 10 What will be the content of Q after these operations. Front is marked by (F) and Rear is marked by (R). Time complexity of linear search algorithm is

Postfix form of ((A + B) * C - (D - E) ^ (F + G)) is

When the list has no elements

When the list has a single element

When the list has two elements

It will work well in all possible cases.

10(R) 13(F)

5(R) 10(F)

13(R) 10(F)

10(R) 5(F)

O (log n) AB + C * DE - FG + ^-

O (n) AB + C * DE - F - G +^

O(n^2) ABC + * DE - - FG +^

O(1) ^ - * +ABC DE + FG

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close