0% found this document useful (0 votes)
37 views

Crash#4 (2nd Year) Computer - 2024

The document contains a practice test with multiple choice and short answer questions on pointers, arrays, and C++ functions. It tests concepts like pointer declarations and dereferencing, array indexing and declarations including multidimensional arrays, built-in functions like sizeof(), strcpy(), strlen(), and strcat(), and differences between strings and arrays.

Uploaded by

maheen syed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Crash#4 (2nd Year) Computer - 2024

The document contains a practice test with multiple choice and short answer questions on pointers, arrays, and C++ functions. It tests concepts like pointer declarations and dereferencing, array indexing and declarations including multidimensional arrays, built-in functions like sizeof(), strcpy(), strlen(), and strcat(), and differences between strings and arrays.

Uploaded by

maheen syed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PAK-TURK MAARIF INTERNATIONAL SCHOOLS & COLLEGES H-8/1

Name: ____________________ Class: HSCC-II


Subject: Computer Time: 80 MIN
Session 2023-24
Total Marks: 40
Crash Test: #4(Chapter 5 &Chapter 7)
Section-A (7)
Q1: Choose the correct answer from the following
1. The expression *test can be said to
A. Be a pointer to test
B. Refer to the content of the test
C. Dereference test
D. Refer to the value of the variable pointed by test
2. What will be happen in this code
Int a=100, b=200;
Int *p=&a;
Int *q=&b;
P=q;

A. a is assigned to a C. a is assigned to b
B. p now pint to b D. q now points to a

3. which of the following access the seventh elements in array

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. #temp C. &float temp


B. &temp D. Float temp&

5. ______ is the correct declaration of an 2-dimesional array.


A. Int array;
B. Int array{10}{10}:
C. Int array[x] [y];
D. Int array[float] [int];
6. Int main()
{
Nt arr[]={0,2,4,6,7,5,3};
Int n,result=0;
For(n=0;n<8;n++){
result+=arr[n];
}
Cout<<result;
Return 0;
}

A. 25 C. 27
B. 26 D. 30

7. _________ is the output of the following code?


int n[5]={87,63}
cout<<n[3];

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

You might also like