Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a true and false type of questions 1. The following variable declaration

ID: 3602212 • Letter: T

Question

This is a true and false type of questions

1. The following variable declaration is correct: int myMess [10] [20] 151 2. The following variable declaration is correct: char myArray[10]; 3. The following statement initializes the array, int nums [2] [3] 1122, 44), 4. The following code makes a copy of theArray {66, 97}, {98,99}}; int int theArray[4] (1,3,5,6); acopy [4] = theArray; 5. The following code prints out: The arrays are not equal int theAr ray [ 4 ] { 1 , 3, 5 , 6 } ; int secondArray[4]1,3,5, 6; if (secondArraytheArray) printf ("The arrays are equal") else printf ("The arrays are not equal") Consider the following code snippet for questions 6-8 int sample [3] [3]={{1,2,3},{4, 5,6},{7,8,9}}; 6. Valid values ofi for the code snippet sample [i] 1]-i are 0, 1, or 2 7. sample [1 [1] contains the value 2 8, printf ("%d %d %d ", sample [ ] [1] ) ; will print one column of 3 values from the matrix Consider the following code snippet for questions 9-12 char name [10]-"Joe" char secondName [10] int i-0 while (name [i] !- '') secon dName [ ] -name [ i++] ; secondName [ -name [ i ] ; 9. the character stored in name [3] ise 10. strlen (name) returns 3 11. islower (name [1]) returns 0 12. after the while loop ends, secondName contains Joe

Explanation / Answer

1. int myMess[10][20][5];

   It is an array declaration not a variable declaration.

so FALSE.

2.char myArray[10];

It is a an array declaration not a variable declaration.

So FALSE.

3.int nums[2][3]={{22.44},{66,97},{98,99}};

this initialization gives an error because the array should have 2 rows and 3 columns but you initialized as 3 rows and 2 columns.

So FALSE

4. int theArray[4]={1,3,5,6};

    int aCopy[4]=theArray;

it gives an error because you are trying to change the address of aCopy array which is not possible.

So FALSE

5.The output of give code snippet is: The arrays are not equal

   because the address of two arrays never equal.

So it is TRUE.

6.TRUE

7.It is FALSE because sample[1][1] contains 5.

8.It is FALSE because it gives an error.

9.it is FALSE because the character stored in name[3] is which null character not e.

10.It is TRUE because the the length of the string name is 3 so strlen(3) returns 3.

11.It is FALSE because islower(name[1]) returns 1 because name[1] is e which is lowercase letter.

12.It is TRUE because in the while loop the contents of name copied into secondName so after while loop secondName contains Joe.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote