//adsense code

MCQ on Arrays and Functions

 UNIT-3 : Arrays and Functions MCQs

1.        Array is an example of which of the following?

(a)   Derived types    (b) fundamental types    (c) user-defined types    (d) None

2.        Array elements are stored in

(a)  Scattered memory locations                      (b) Sequential memory locations

(c)   Direct memory locations                           (d) None

3.        int a[10] will reserve how many locations in the memory?

(a)   10              (b) 9                (c) 11               (d) None of the above

4.        Which one of the following is the correct syntax for initialization of one-dimensional arrays? 
(a) int num[3]={0 0 0};  (b) int num[3]={0,0,0};
(c) int  num[3]={0;0;0};                                 (d) int num[3]=0;


5.       
Under which of the following conditions, the size of the array need not be specified? 
(a) When the compiler is smart  (b) When initialization is a part of definition
(c) Both                                       (d)    None


6.        Which of following is correct array declaration

A) int num(25);          B) int array num[25];   C) int num[25];       D) num[25];


7.       Array subscripts in ‗C‘ starts from

A) 0                 B) compiler dependent               C) 1                         D) -1


8.        Array elements are stored in

A) Column major order                      B) in diagonal order

C) Row major order                         D) either in row major or column major order


9.       Which of the following statements is used to read a string of characters into the array words?

A) scanf(%d, words);                      B) scanf(% \n, words);

C) scanf(“%s”, words);                    D) scanf( %c, words);


 10.A string constant is one dimensional array of characters terminated by a

A) Comma       B) Full stop       C) Semicolon                  D) Null character („\0‟)

11.   Which of the following multi-dimensional array declaration is correct for realizing a 2 X 3 matrix

(a) int m[2][3];           (b) int m[3][2];                       (c) int m[3],m[2];                                    (d) None


12.   Which of the following is the correct syntax for initialization of two-dimensional arrays?

(a) table[2][3]={0,0,0,1,1,1}              (b) table[2][3]={{0,0,0,}{1,1,1}} (c) table[2][3]={0,1},{0,1}{0,1}             (d) None



13.  
What will be assigned for marks[3] and marks[4] in the following initialization int marks[5]={30,45,80};

(a)  80 and garbage     (b) garbage and garbage         (c) 0 and 0      (d) None


14.   Which of the following is correct initialization of string TITAN

(a) char name[ ]=‖TITAN\0‖               (b) char name[10]=‖TITAN\0‖

(c) char name[ ]=”TITAN              (d) char name[ 10]={TITAN}


15.   Which of the following initialization is wrong

(a) x[5]=15      (b) x[10.3]=30            (c) x[0]=20      (d) None



16. char ch[ ]={‗a‘,‘b‘,‘c‘,‘\0‘}; int sum=ch[1]+ch[2];


What is the value of sum?

(a) 195             (b) 197            (c) ab               (d) error


17.   What happens if we initialize an array as int group[20]={0};

(a)   Produce an error                                        (b) Only 0th element is initialized with zero

(c) Every element is initialized with zero     (d) None


18.   To store a table of values which of the following is used

(a)   One dimensional array                  (b) Two dimensional array

(c) Three dimensional array                 (d) None 



19. int
rank[3]={3,2,4,1,5};
(a) Compile time error                     (b) Initializes only 3 elements with first 3 values
(c) Initializes only 3 elements with last 3 values  (d) Initialize all elements with zeros


20.    How to refer an element in ith row jth column of a two dimensional array

(a) x[i,j]          (b) x[i][j]        (c) x[ij]           (d) x[i]x[j]


21.    A function can be called in a program

A. Only two times      B. Only once   C. Any number of times     D. Only three times


22.    When you pass an array as an argument to a function, what actually gets passed

A. Address of the array                     B. Values of the elements of the array
C. Number of elements of the array    D. None


23.    The statement used to send back any value to the calling function is

A. break                      B. continue                 C. exit             D. return


24.    The function sqrt( ) is part of header file.

A. conio.h                   B. stdio.h                    C. math.h        D. iostream.h



25.   
A function can return only       value

A. Zero            B. One                        C. two                         D. three


26.    Actual and formal parameters must agree in

A. Data types                          B. Number of arguments and Data types
C. Names and Data type                                 D. None


27.    Any function can be called from any other function. This statement is

A. True sometimes    B. Neither true nor false         C. False           D. True



28.   
The header file that must be included at the beginning of a C program to use a library function cos() is

A. stdlib.h                   B. conio.h       C. dos.h           D. math.h


29.                       function is said to be function calling itself.

A. Call by reference   B. Call by value          C. Recursive     D. All above


30.    void funct (void);

The above function declaration indicates       

  A. it returns a value and had arguments                B. it returns nothing and had arguments
C. it returns a value and no arguments           D. it returns nothing and no arguments


31.    
The parameters of the called function(function definition) are called

A. Casual parameters  B. formal parameters  C. usual parameters D. actual parameter


32.    Recursion means 

A. Function calling same function                        B. Function calling a function
C. Both                                                             D. None


33.    A function is one that returns no value has         return type 

A. Void B. Integer                    C. Float                       D. Recursive


34.    The parameters in a function call are

A. Real parameters     B. Formal parameters 

C. Actual parameters                D. Dummy parameters


35.    Based on arguments and return types, functions are classified into

A. 1 type                     B. 2 types                    C. 3 types                    D. 4 types


36.    Maximum number of arguments can be passed to a function are

A. 2                 B. 3                 C. 4                 D. Any


37.    The default parameter passing mechanism is

(a) Call by value        (b) Call by reference   (c) Call by name         (d) None


38.    Any C program         

(a) Must contain at least one function         (b) need not contain any function
(c) Needs input data                                        (d) None


39.    Call by reference is also known as

(a) Call by address or Call by location  (b) Call by address or Call by value
(c) Call by value or Call by name          (d) None



40.   
Determine output: main()
{
int i=abc(10); printf(%d,--i);
}
int abc(int i)
{          return(i++);     }
 

(a) 10               (b)   9              (c) 11              (d) None

Related Posts

Subscribe Our Newsletter

0 Comments to "MCQ on Arrays and Functions"

Post a Comment

Share your view here!!