0% found this document useful (0 votes)
107 views2 pages

Amcat - 8 - C

The document is a sample test containing 11 multiple choice questions related to computer programming concepts. Specifically: 1) The first question asks to identify the value of variable "X" when performing a binary search on an array. 2) The second question asks to identify which statement should be removed from a code sample to rectify an error. 3) The questions cover topics like complexity analysis, sorting algorithms, matrix addition, operator precedence, and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views2 pages

Amcat - 8 - C

The document is a sample test containing 11 multiple choice questions related to computer programming concepts. Specifically: 1) The first question asks to identify the value of variable "X" when performing a binary search on an array. 2) The second question asks to identify which statement should be removed from a code sample to rectify an error. 3) The questions cover topics like complexity analysis, sorting algorithms, matrix addition, operator precedence, and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Six Phrase – The Finishing School

93A GKD Nagar P.N.Palayam Coimbatore – 641037


Prabhu N.D. – 99946 75750
www.sixphrase.com | [email protected]

COMPUTER PROGRAMMING: C. Statement 3


1.A programmer writes a program to find an element in the array A[5] with D. Statement 4
the elements: 8 30 40 45 70 .The program is run to find the number 3.Which of the following statements is TRUE about a breadth first search?
”X”,that is found in the first iteration of the binary search.What is the A.Beginning from a node ,all the adjacent nodes are traversed first
value of “X”? B. Beginning from a node,each adjacent node is fully explored before
A.40 traversing the next adjacent node
B.8 C. Beginning from a node,the nodes are traversed in cyclic order
C.70 D.None of the above
D.30 4.A function in the base class is redefined in the inherited class.What is
2.Passage: the term used to describe this situation?
Class brush A. Inheritance
{ B. Overriding
private: C. Overloading
integer size,c D. Encapsulation
rcode 5. Code A contains a set of eight lines that occur ten times in different
function getdata() {……}//Statement 1 points of the program.this code is passed to a programmer who puts the
public: set of eight lines in a function definition and calls them at the ten points
integer name //Statement 2 in the program.Assume this new code to be Code B.Which code will run
function putdata(){……} faster using an interpreter?
} A. Code A
function main B. Code B
{ C. Both the codes would run at the same speed
brush b1,b2 D. None of the above
print b1,name //Statement 3 6. What does the following function do?
b2.getdata() // Statement 4 function operation(int a,int b)
} {
Choose the correct answer: If(a>b)
Refer to the pseudocode given in the “Passage”.The code is similar to that { return operation(b,a) }
in C++ and is self-explanatory. An accessible member function and a data Else
member for an object are accessible by the statements { return a; }
odjectname.functionname and objectname.datamembername,respectively. }
Which statement should be deleted from the code to rectify the error in it? A. Always returns the first parameter
A. Statement 1 B. Returns the min of (a,b)
B. Statement 2 C. Returns the max of (a,b)
D. Loops forever print a*b/(c-d)
7. Codes A and B have complexities (n^3) and ω(n^3),respectively.A A. The outputs differ by 80.
sufficiently large problem with size “k” needs to be solved.Which of the two B. The outputs are the same.
codes should be used?
A. Code A 11. Which of the following sorting methods is stable?
B. Code B A.Straight insertion sort
C. Any of the two codes can be used since both the same execution time B.Binary insertion sort
D. None of the above C.Shell sort
8. A programmer writes an efficient program to add two upper triangular D.Heap sort
10x10 marices with the elements on the diagonals retained.How many
total additions will the program make?
A. 100
B. 55
C. 25
D. 10
9.What will the output of the following pseudocode statements be?
integer a= 456,b,c,d=10
b=a/d
c=a-b
print c
A. 410
B. 410.4
C. 411.4
D. 411
10. Assume the following precedence (high to low).Operators in the same
row have the same precedence.
(.)
* /
+ -
AND
OR
The precedence is from left to right in the expression for the operators with
equal precedence.
Which of the following statements is TRUE about the output of the code
statements given below?
integer a=40,b=35,c=20,d=10
print a*b/c-d

You might also like