0% found this document useful (0 votes)
12 views

Sample-Questions_Computer-Programming_741

The document contains a set of sample questions related to computer programming, focusing on concepts such as time complexity, output of loops, binary search, and object-oriented programming. Each question provides multiple-choice answers for the reader to select from. The questions assess understanding of programming logic and syntax.

Uploaded by

pamela.saha28
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)
12 views

Sample-Questions_Computer-Programming_741

The document contains a set of sample questions related to computer programming, focusing on concepts such as time complexity, output of loops, binary search, and object-oriented programming. Each question provides multiple-choice answers for the reader to select from. The questions assess understanding of programming logic and syntax.

Uploaded by

pamela.saha28
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/ 3

Sample Questions

Computer Programming

Directions: Choose the correct option.

Q1. A programmer is given an efficient code to sum two nXn matrices and store the result in a
third matrix. She is asked to find its time complexity. She realizes that the number of iterations
required is more than n. What can she claim regarding the complexity of the code?

A. It is O(n)
B. It is O(n2)
C. It is Θ(n)
D. It is ω(n)

Directions: Choose the correct option.

Q2. What is the output of the program given below?

integer i = 0, j
while (i<2)
{
j = 0;
while (j<= 3*i)
{
print j
print blank space
j=j+3
}
print end-of-line //takes the cursor to the next line
i=i+1
}

© Aspiring Minds Assessment Pvt. Ltd.


A. 0
03
B. 0 3
036
C. 0
036
0369
D. 0 3 6
0369
0 3 6 9 12

Directions: Choose the correct option.

Q3. A programmer writes a program to find an element in the array A[5] with the elements: 8
30 40 45 70. The program is run to find a number "X", that is found in the first iteration of
binary search. What is the value of "X"?

A. 40
B. 8
C. 70
D. 30

Directions: Choose the correct option.

Q4. Refer to the given pseudocode. The code is similar to that in C++ and is self-explanatory. An
accessible member function and a data member for an object are accessed by the statements
objectname.functionname and objectname.datamembername, respectively. Which statement
should be deleted from the code to rectify the error in it?

© Aspiring Minds Assessment Pvt. Ltd.


class brush
{
private:
integer size, c

rcode
function getdata( ) { ... }// Statement 1
public:
integer name // Statement 2
function putdata( ) { ... }
}

function main
{
brush b1, b2
print b1.name // Statement 3
b2.getdata( ) //Statement 4
}

A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4

© Aspiring Minds Assessment Pvt. Ltd.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy