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:

If an array is declared as arr[] = {1,3,5,7,9}; then what is the value of sizeof(arr[3]) ?  


1
2
3
8

Answer:

NO Eaplanation

Share Me:

If an array is declared as arr[] = {1,3,5,7,9}; then what is the value of arr[3] ?  


1
7
9
5

Answer:

in index 3 the value 7 is present

Share Me:

If an array is declared as double arr[50]; how many bytes will be allocated to it?  


50
100
200
400

Answer:

400

Share Me:

If an array is declared as int arr[50] , how many elements can it hold?  


49
50
51
0

Answer:

50

Share Me:

If an array is declared as int arr[5][5] , how many elements can it store?  


5
25
10
0

Answer:

25

Share Me:

Given an integer array arr[] ; the i th element can be accessed by writing  


*(arr+i)
*(i + arr)
arr[i]
All of these

Answer:

All of these

Share Me:

Insert("XXXYYYZZZ", 1, "PPP") =  


PPPXXXYYYZZZ
XPPPXXYYYZZZ
XXXYYYZZZPPP
XXXYYYZZZPPPX

Answer:

XPPPXXYYYZZZ

Share Me:

Delete("XXXYYYZZZ", 4,3) =  


XXYZ
XXXYYZZ
XXXYZZ
XXXYZZX

Answer:

XXXYZZ

Share Me:

If str[] = "Welcome to the world of programming" , then SUBSTRING(str, 15, 5) =  


world
programming
welcome
none of these

Answer:

world

Share Me:

strcat() is defined in which header file?  


ctype.h
stdio.h
string.h
math.h

Answer:

string.h

Share Me:

A string can be read using which function(s)?  


gets()
scanf()
getchar()
all of these

Answer:

all of these

Share Me:

Replace("XXXYYYZZZ", "XY", "AB") =  


XXABYYZZZ
XABYYYZZZ
ABXXXYYYZZ
ABXXXYYYZZZ

Answer:

XXABYYZZZ

Share Me:

The index of U in Oxford University Press is?  


5
6
7
8

Answer:

7

Share Me:

s1 = “HI”, s2 = “HELLO”, s3 = “BYE”. How can we concatenate the three strings?  


strcat(s1,s2,s3)
strcat(s1(strcat(s2,s3)))
strcpy(s1, strcat(s2,s3))
strcpy(s2, strcat(s2,s3))

Answer:

strcat(s1(strcat(s2,s3)))

Share Me:

strlen(“Oxford University Press”) is ?  


22
23
24
25

Answer:

23

Share Me:

Which function adds a string to the end of another string?  


stradd()
strcat()
strtok()
strcpy()

Answer:

strcat()

Share Me:

A data structure that can store related information together is called  


Array
String
Structure
All of these

Answer:

All of these

Share Me:

A data structure that can store related information of different data types together is called  


Array
String
Structure
All of these

Answer:

Structure

Share Me:

Memory for a structure is allocated at the time of  


Structure definition
Structure variable declaration
Structure declaration
Function declaration

Answer:

Structure variable declaration

Share Me:

A structure member variable is generally accessed using  


Address operator
Dot operator
Comma operator
Ternary operator

Answer:

Dot operator

Share Me:

A structure that can be placed within another structure is known as  


Self-referential structure
Nested structure
Parallel structure
Pointer to structure

Answer:

Nested structure

Share Me:

A union member variable is generally accessed using the  


Address operator
Dot operator
Comma operator
Ternary operator

Answer:

Dot operator

Share Me:

typedef can be used with which of these data types?  


struct
union
enum
all of these

Answer:

all of these

Share Me: