The program prints increasing numbers in rows, with each row offset by 3. The output would be:
0
0 3
3 6 9
The function calculate() returns 80. It modifies the value passed in a by multiplying by 2 and adding b. This value (40) is then returned and added to the value passed in as d (10).
A hash table with maximum 10 records and current records in locations 1, 3, 4, 7, 8, 9, 10, the probability a new record is inserted into location 2 is 0.1.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views
Computer Programming Sample Questions
The program prints increasing numbers in rows, with each row offset by 3. The output would be:
0
0 3
3 6 9
The function calculate() returns 80. It modifies the value passed in a by multiplying by 2 and adding b. This value (40) is then returned and added to the value passed in as d (10).
A hash table with maximum 10 records and current records in locations 1, 3, 4, 7, 8, 9, 10, the probability a new record is inserted into location 2 is 0.1.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Computer Programming Sample Questions
answer answer answer
questionStatement A answerB C answerD E
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 } 0<br/>0 03 print \takes the cursor to the next line 3 6<br/>0 3 i=i+1 0<br/>0 0 3<br/>0 6<br/>0 6 9<br/>0 What will be the output of the program? 3 36 369 3 6 9 12 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( ) ? 80 40 32 72 lower upper Smallest element of an array's index is called its bound range bound extraction Degree of each Degree of The vertex in each graph the vertex in should The graph graph the graph have should For a path to be Eulerian, which of the following should should be even have odd conditions are necessary and sufficient? be even. odd. edges. edges. 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 0.6 0.1 0.2 0.5 Some where in We have a max heap with n elements. We insert an Top of Bottom betwee Cannot be element which is larger than all elements in the heap. the of the n the determine Where will it be inserted? heap heap heap. d A list is implemented as a singly linked link-list. The When When the When It will work address of the first and last node are 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 } the list the list } has no list has a has two well in all In which of the following scenarios will the code not element single element possible work properly? s element s cases. 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. 10(R) 13(R) Front is marked by (F) and Rear is marked by (R). 13(F) 5(R) 10(F) 10(F) 10(R) 5(F) Time complexity of linear search algorithm is O (log n) O (n) O(n^2) O(1) AB + C * AB + C * ABC + * DE - FG DE - F - G DE - - FG ^ - * +ABC Postfix form of ((A + B) * C - (D - E) ^ (F + G)) is +^- +^ +^ - DE + FG
Introduction to Algorithms 3rd Edition by Thomas Cormen, Charles Leiserson, Ronald Rivest, Clifford Stein ISBN 0262033844 9780262033848 instant download