C++ Language Interview Questions and Answers for Freshers Pdf - 1

Question: 1

What is an array?

An array is a collection of variables of the same type that are referenced by a common name.

Arrays are of two types:

One dimensional: comprising of finite homogenous elements.

Multi dimensional: comprising of elements, each of which is itself a one dimensional array.

Question: 2

What the data types can be used in two dimensional arrays?

The dimensions (rows/columns) of an array can be indicated

Using integer constants

Using const identifier of integer or ordinal

Using char constants

Using enum identifiers.

Question: 3

What are strings?

Strings are otherwise called as literals, which are treated as single dimension of characters.

The declaration of strings is same as numeric array.

For examples Char name [10];

Char vowels [] = {‘a’, ‘e’, ‘I’, ‘o’, ‘u’}

Question: 4

What is matrix?

A matrix is a set of m*n numbers arranged in the form of a rectangular array of m rows and n columns.

Matrices can be represented through 2-D arrays.

Question: 5

Explain the memory representation of 2-D arrays.

A 2-D array is stored in sequential memory blocks. The elements are stored either,

Row wise manner (this method is called as row-major order).

Column wise manner (this method is called as column-major order).

Related Questions