Professional Documents
Culture Documents
A. a is assigned to a C. a is assigned to b
B. p now pint to b D. q now points to a
A. array[6]; C. array(7);
B. array[7]; D. array;
4. which of the following indicates the address of a variable ‘temp” of type float.
A. 25 C. 27
B. 26 D. 30
A. 0 C. 63
B. -1 D. 3
Section B (3*8=24)
1. Write down the output of the following program segment:
int values [ ] = {4, 17, 20, 9, 23};
cout << values [2] << "\n";
cout << ++values [0] <<"\n";
cout << values [1] ++ <<"\n";
2. Consider the array definition: float table [5][5];
a. How many elements does an array have?
b. Write statement that assigns 36.5 to the first element of array.
3. What is reference operator? Give example.
4. Trace the output of the following code, suppose address of a is 001, and address of b is
002,p is 003,and q is 004.
Int a=9,b=11;
Int *p=&a,*q=&b;
cout<<*p;
cout<<*q;
cout<<&a<<&b;
cout<<&(*q);
5. Differentiate string and array with example?
6. Define the sizeof() function with example.
7. Differentiate between reference operator and dereference operator?
8. Determine the output of the following C++ program and fill the columns of the given table.
SECTION-C(5*2=10)
1. (a). Write the purpose of the following functions
i. Strcpy() ii. Strlen() iii. Strcat()
(b). for the given array
Int A[3][4]={{4,18,-16,11}{-5,10,-2,12}{15,-3,17,18}};
Write a program to find the sum of positive number.
2. (a) Write the program that reads two strings, copies it into other string and then print
both string.
(b) for the given array
Int a[3][4] ={{14,8,11,10}{15,12,20,3}};
Int b[2][4]={{2,3,4,7}{6,7,8,9}};
Write a program that add two array and produce following output.
16 11 15 17
21 19 28 12