Array MCQ - General Knowledge Question and Answer

Array MCQ - Question and Answer

In this Chapter, we are going to discuss some questions related to array

1. Let A be a dimensional array declared as follows A:[1….10][1…..15] of integers. Assume that each integer takes one memory location, the array is stored in row-major order and the first element of the array is stored at location 100, what is the address of the element A[i][j]?  


15i+j+84
15j+i+84
10i+j+98
d. None of the above

Answer:

15i+j+84

Share Me:

Faster access to non-local variables is achieved using an array of pointers to activation record called a  


heap
activation tree
display
stack

Answer:

Faster access to non-local variables is achieved using an array of pointer to activation records called a display

Share Me:

If int s[s] is a one-dimensional array of integers, which of the following refers to the third element of in the array?  


*(s+2)
s+3
*(s+3) + 5
*(s+3) + 2

Answer:

*(s+2)

Share Me:

How array values can be held by an array defined as A(-1.....n, 1…..n)?  


n(n-1)
n2 (n-1)
n(n+1)
n(n+2)

Answer:

n(n+2)

Share Me:

Suppose we want to arrange n numbers stored in an array such that all negative values occur such before all positive ones. Minimum number of exchange required in the worst case  


n-1
n
n+1
none of the above

Answer:

n-1

Share Me: