Docsity

C++ Programming: Theoretical Concepts & Core Syntax Guide, Summaries of Career Counseling

Partial preview of the text

Download C++ Programming: Theoretical Concepts & Core Syntax Guide and more Summaries Career Counseling in PDF only on Docsity!

q 4 tment College of Electronic Technology Fall 2024-2025 Computer departme Midterm exam C++ programming Std. name: Std. Td: i : True/F. 1 point each ; ; ag il fot dashing a we 3D array of integers with dimensions 3x4x5. Is int arr[3,4,5]. a) True b) False ; 2. ti delete[] operator in C++ can only be used to free memory allocated with new[] for arrays. a) True b) False » A structure in C++ cannot contain arrays or pointers as members. a) True b) False 4. Is this statement correct in C++ a) True b) False int rel=func I (arrl [3]2],3 2); Section 2: Multiple Choice(1 point each) 1, What is the size of a three-dimensional array of integers declared as int arr(3][4][5]; in C++? a) 12 bytes b) 60 bytes c) 12 elements d) 60 elements 2. Which of the following i allocated three-dimensio: a) art[iJ[ilk]; b) arr[i][j * kj; c) arr{i) GK]: d) arr[i * j * kj); - What is the purpose of the void retum type in C++ functions? a) It indicates the function returns a pointer. b) It indicates the function returns no value. ¢) It indicates the function returns an integer. d) It is used for functions with arguments. | $a valid way to access an element of a dynamically nal array in C++? 6) CamScanner 4. What will be the output of the following code? Hinclude using namespace std; int mystery(int n) { if (nN ==0) retum 1; _ Tetum n * mystery(n - 1);} int main() { cout<<"value ="< using namespace std; int main() { int arr[S] = {1; 2, 3, 4, 5}; for (int i = 0; i<= 5; i+=1) { cout< using namespace std; int findMax(int arr[][3], int rows) { int max = arr[0][0); for (int i = 0; i<= rows; i++) { for (int j =0; j <3; j++) { if (arr[i)[j] <=max) { arr][i]=max; } } 3 return max; int main() { int arr[2][3] = {{1, 2, 3}, {4, 5, 6}}; cout<< "Max: " <