Answered step by step
Verified Expert Solution
Question
1 Approved Answer
QUESTION 3 Consider the following code: int arr[5] = { 5, 12, 13 }; int *ptr = arr; ptr++; *ptr = 27; After this code
QUESTION 3 Consider the following code: int arr[5] = { 5, 12, 13 }; int *ptr = arr; ptr++; *ptr = 27; After this code has been run, what does the array contain? O 5, 12, 13, 27} O {27, 12, 13} O {5, 27, 13} O {5, 27, 12, 13} QUESTION 4 Consider this line of code: A. 12 char *str = "Alphabet soup"; Match the following questions with their answers v How many characters are in this string? How many bytes are required to hold this string in memory? What function will tell us how many characters are in the string? Where is this string stored in memory? B. 100 C. 14 D. 12 E. strlen F. Stack memory G. Global memory QUESTION 5 Consider the following code: char buff[100]; printf ("Enter word: "); scanf("%s", buff); We want to test if the user entered the word Hello. This of the following code fragments is correct? O if (buff.equals("Hello")) { ... } O if (buff == "Hello") { ... } if (strcmp(buff, "Hello")) { ... } O if (strcmp(buff, "Hello") == 0) { ... } O if (buff = "Hello") { ... } QUESTION 6 Consider the following code: struct pair { int x, y; }; We want to declare z to be a pair, and to set z's x value to 1 and y value to 2. Which of the following code fragments will correctly do this? Check all that apply struct pair z = {1, 2}; O struct pair z; Z.X = 1; z.y = 2; Ostruct pair z; Z->X = 1; Z->y = 2; pair z(x = 1, y = 2)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started