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

What is the value of ptr after the execution of the following lines? ptr = 2000;

ID: 3913109 • Letter: W

Question

What is the value of ptr after the execution of the following lines?
ptr = 2000;
ptr+=2;

Let's assume the integer array list is initialized with values 1, 2, 3, 4 and 5. The name of the array is assigned to a pointer called ptr. After executing these lines what will be the output?
ptr++;
printf("%d ", list[0]);
printf("%d ", ptr[0]);

Let's assume an array of characters is initialized with the string hello world written in double quotes. What will be the size of this array?

Let's assume an array of characters called list is initialized with the string hello world written in double quotes. The name of this array is assigned to a character point p. Both p and list are incremented by 1. What will be the output of the following lines?printf("%c %c ",list[0], p[0]);

An array of char pointer called p is initialized with the names: John, David, Jack and Jane. Each one is written in double quotes. What does the following code display?
printf("%s", p[1]);

A) 2004

Explanation / Answer

What is the value of ptr after the execution of the following lines? ptr = 2000; ptr+=2; A) 2004 B) 2002 C) 2001 D) 2008 E) 2000 Assuming, ptr is a pointer to int, it will move by 2 integer blocks. As int is of size 4 bytes, ptr will become 2008. Option D ------------------------------------------------ Let's assume the integer array list is initialized with values 1, 2, 3, 4 and 5. The name of the array is assigned to a pointer called ptr. After executing these lines what will be the output? ptr++; printf("%d ", list[0]); printf("%d ", ptr[0]); A) 1 1 B) 1 2 C) 2 2 D) There will be a syntax error Doing ptr++ move ptr to the second element, while list is strill pointing to the first element. hence Option B. ------------------------------------------------ Let's assume an array of characters is initialized with the string hello world written in double quotes. What will be the size of this array? A) 10 B) 11 C) 13 D) 12 E) 5 Option D, there are 11 characters = 1 null character to end the string. hence size of array will be 12. ------------------------------------------------ Let's assume an array of characters called list is initialized with the string hello world written in double quotes. The name of this array is assigned to a character point p. Both p and list are incremented by 1. What will be the output of the following lines?printf("%c %c ",list[0], p[0]); A) world world B) There will be a syntax error C) h h D) e e Option B, you can not increment a character array list. ------------------------------------------------ An array of char pointer called p is initialized with the names: John, David, Jack and Jane. Each one is written in double quotes. What does the following code display? printf("%s", p[1]); A) prints the character o B) This will produce a syntax error C) John D) David E) The program will crash. p[1] refers to the first word.. so it will print david.

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