CS201- Introduction to Programming Current Quizzes Q.1 char name [] = Hello World ; In the above statement, a memory of characters will be allocated 13 11 12 (Ans) Q.2 A function is a block of statements that can be defined once and used in the program. one time 2 time three time as many times as user wants (Ans) Q.3 What will be the size of following array? int arr[29] 0 30 (Ans) 29 28 Q.4 Which of the following function call is call by reference for the following function prototype? int add (int *) add(&x); (Ans) add(int x); add(x); add(*x); Q.5 ----------- statement is used to terminate the processing of a particular case and exit from switch structure. if goto break (Ans) continue Q.6 will be used for enclosing function statements into a block. "" () []
{} (Ans) Q.7 Default mechanism of calling a function by passing it array is call by and in case of passing variable is call by Reference, Reference Reference, value (Ans) Value, Reference Value, Value Q. 8 What is the output of the following code, if the first case is true switch (var) { case a : cout apple endl; case b : cout banana endl; case m : cout mango endl; default: cout any fruit endl; } apple anyfruit apple banana mango* none of above apple only? Q.9 Functions declared with the specifier in a class member list are called friend functions of that class. protected private public friend Q.10 Public or private keywords can be written only for once in the class or structure declaration written multiple times in the class or structure declaration written only twice in the class declaration written outside the class Q.11 Good practice is to write public or private keywords only once in the class or structure declaration, though there is no syntactical or logical problem in writing them multiple times. The friend keyword provides access. in one direction only in two directions to all classes to the data members of the friend class only
Q.12 References cannot be uninitialized. Because it is impossible to reinitialize a pointer reinitialize a reference initialize a NULL pointer cast a pointer Q.13 new operator can be used for. only integer data type only char and integer data types integer, float, char and double data types dot operator Q.14 The destructor is used to. allocate memory deallocate memory create objects allocate static memory Q.15 Reference is not really an address it is. a synonym an antonym a value a number Q.16 If we want to allocate memory to an array of 5 integers dynamically, the syntax will be. int *iptr ; iptr = new int[5] ; integer iptr** ; iptr= new int[5] int iptr ; iptr= int [5] iptr= new[5] Q.17 Memory allocated from heap or free store. can be returned back to the system automatically can be allocated to classes only cannot be returned back unless freed explicitly using malloc and realloc cannot be returned back unless freed explicitly using free and delete operators
Q.18 Operator overloading is to allow the same operator to be bound to more than one implementation, depending on the types of the. Compilers Operands Function names Applications Q. 19 The operator to free the allocated memory using new operator is. free del delete remove Q.20 To read command-line arguments, the main() function itself must be given arguments a. 1 b. 2 ANS c. 3 d. 4 Q.21 Returns true if c is a digit or a letter and false otherwise. a. int isalnum( int c ) ANS b. int isalpha( int c ) c. int isxdigit( int c ) Q.22 The increment of a pointer depends on its. a. data type ANS b. value c. variable Q.23 dereferencing operator is represented by a. + b. * ANS c. &
Q.24 There is a pointer variable named ptr of type float then address of which type of variable the ptr will store in it? a. int b. float. ANS c. double. Q.25 suppose we have int y[10]; To access the 4th element of the array we write a. y[4] b. y[3] ANS c. y(4) Q.26 Given a two dimensional array of integers, what would be the correct way of assigning the value 6 to the element at third row and fourth column? a. array[2][4] = 6 ; b. array[3][4] = 6 ; c. array[2][3] = 6 ; ANS Q.27 At the, we try to break up the problem into functional units 1 design phase ANS 2 Implementation phase 3 analysis phase 4 None of the given