int arr[10];int arr[10][10];int arr{10};int arr(10);int arr[5] = {1, 2, 3}; initialize in C?int arr[10, 10];int arr[10][10];int arr{10}{10};int arr(10)(10);int arr[3][4];?sizeof()strlen()count()num()whilefordo-whilegotoarr?arr[2]arr[3]arr(2)arr{3}delete functiondata_type array_name[size1][size2]...[sizeN];data_type array_name[size1, size2];data_type array_name{size1,size2};data_type array_name(size1)(size2);int arr[3][3][3];int arr[3,3,3];int arr(3)(3)(3);int arr{3}{3}{3};arr[1][2][3] refer to in a 3D array?int arr[2][3][4];?char str[10] = "Hello";char str = "Hello";char str[10] = 'Hello';char str = 'Hello';\n\0\r\tchar str[20];char str[20][20];char str{20};char str(20);strlen()strcat()strcpy()strcmp()strlen, strcpy, strcat, strcmp)strcat()strcpy()strcmp()strlen()strcat()strcpy()strcmp()strlen()strcmp(str1, str2) returns 0 when:str1 is greater than str2str1 is less than str2str1 is equal to str2str2 is emptystrcat()strcpy()strcmp()strlen()strlen("Hello") return?char arr[5][10];int arr[5];string arr[5];str arr[5];char arr[3][10];, what does arr[2] represent?arr[3][10];?arr[2][0]arr[0][2]arr[1][0]arr[0][1]strsort()qsort()arraysort()sort()int arr[3][3] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };, what is the value of arr[1][2]?int arr[10];, how many bytes are allocated if int is 4 bytes?arr[5] = arr[4]; do if arr is an integer array?arr[4] to arr[5]arr[5] to the value of arr[4]arr[5]strlen and strcpy?#include <stdlib.h>#include <math.h>#include <string.h>#include <stdio.h>char str[] = "Hello";, what is the value of str[5]?'o''H'\0undefinedint arrays\0strrev()strreverse()stringreverse()strrevrs()strcmp function return if str1 is lexicographically greater than str2?str1 = "abc" and str2 = "def", what is the result of strcat(str1, str2);?"abcdef""defabc""abc def"Errorstrcpy()strncpy()strcat()strtrunc()strcmp()strsame()strequal()strmatch()strlen(arr[1]) return if arr is a 2D character array containing { "apple", "banana", "cherry" }?char arr[2][6] = {"hello", "world"};, what is arr[1][4]?'d''o''\0''r'| Question | Answer |
|---|---|
| 1 | a) An array is a collection of variables of the same type stored in contiguous memory locations |
| 2 | c) arr[0] |
| 3 | b) arr[4] |
| 4 | b) float |
| 5 | d) Index |
| 6 | a) 0 |
| 7 | c) arr[2][2] |
| 8 | c) arr[2][1] |
| 9 | b) 6 |
| 10 | d) arr[3][2] |
| 11 | a) sizeof(arr) / sizeof(arr[0]) |
| 12 | b) sizeof(arr) / sizeof(int) |
| 13 | c) 2D array |
| 14 | b) It has two dimensions |
| 15 | c) sizeof(arr) / (sizeof(int) * 3) |
| 16 | a) An array is a collection of elements of the same type |
| 17 | d) 3 |
| 18 | a) Constant size |
| 19 | b) int arr[10] = {0}; |
| 20 | c) Array elements can be accessed using the index |
| 21 | c) Index starts from 0 |
| 22 | a) All elements must be of the same data type |
| 23 | b) arr[2][1] |
| 24 | a) arr[1][2] |
| 25 | d) int arr[3] = {1, 2, 3}; |
| 26 | c) 3 |
| 27 | b) Character array |
| 28 | a) Arrays must be initialized with curly braces {} |
| 29 | d) 4 |
| 30 | b) 2 |
| 31 | a) Character array |
| 32 | c) Constant values can be assigned to individual elements |
| 33 | b) The memory location of the first element |
| 34 | d) Subscript notation |
| 35 | a) Array initialization is optional |
| 36 | c) 6 |
| 37 | c) 40 |
| 38 | c) Undefined behavior |
| 39 | d) O(1) |
| 40 | b) Sets arr[5] to the value of arr[4] |
| 41 | c) #include <string.h> |
| 42 | c) \0 |
| 43 | b) Strings are character arrays terminated by \0 |
| 44 | a) strrev() |
| 45 | a) Positive value |
| 46 | a) "abcdef" |
| 47 | b) strncpy() |
| 48 | a) strcmp() |
| 49 | a) 6 |
| 50 | a) 'd' |