Question: u Question 1 1 pts Consider the following code segment: char message [500] = Hello; char name[100] = Joe Shmoe; Which of the following lines

![message [500] = "Hello"; char name[100] = "Joe Shmoe"; Which of the](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3c930b1ddc_78466f3c9303345e.jpg)
u Question 1 1 pts Consider the following code segment: char message [500] = "Hello"; char name[100] = "Joe Shmoe"; Which of the following lines of code will concatenate the first name "Joe" at the end of the char array message, so the message variable contains "Hello Joe"? strcmp(message, name); strstr(message, name); Ostrncat(message, name, 3); strncmp(message, name, 3); strcat(message, name); Question 2 1 pts What is the problem with the following code? char str1[ ] = "None"; char str2[ ] = "Message to copy"; strcpy(stri, str2); //copy str2 into stri buffer overflow: strcpy() will copy past the end of array str1 (str1 is not large enough) buffer overflow: strcpy() will copy past the end of array str2 (str2 is not large enough) There are no bugs in this code No answer text provided. Question 3 1 pts Which is a correct way of dynamically allocating enough space for an array of 10 integers? int* pArray = malloc(sizeof(int)); float* pArray = malloc(10* sizeof(float*)); O int* pArray = malloc (10 *sizeof(int*)); int* pArray = malloc (10); int* pArray = malloc (10*sizeof(int)); float* pArray = malloc(10* sizeof(float)); float* pArray = malloc(sizeof(float)); Question 4 1 pts Which is a correct way of dynamically allocating enough space for an array of 10 floating point values? int* pArray = malloc(sizeof(int)); float* pArray = malloc(10* sizeof(float*)); int* pArray = malloc(sizeof(int)); float* pArray = malloc(10); float* pArray = malloc(sizeof(float)); float* pArray = malloc(10* sizeof(float)); int* pArray = malloc(10* sizeof(int))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
