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

Given the following code and considering things like ASCII values and pointer ad

ID: 3791456 • Letter: G

Question

Given the following code and considering things like ASCII values and pointer addresses:

int num1 = 5; //addressed at 1767612

int num2 = 10; //addressed at 1767600

int num3 = 15; //addressed at 1767588

char ch1 = ‘a’; //addressed at 3734375

char ch2 = ‘b’; //addressed at 3734363

char ch3 = ‘c’; //addressed at 3734351

char* chPtr = &ch3;

int* iPtr = &num3;

*iPtr = num3 * 8;

*chPtr = *iPtr;

What will the following statement output?

cout << ch3;

'c'

'P'

'x'

3734351

120

1 points   

QUESTION 2

Which of the following statements will assign the address of the variable int myInt to the pointer int* myPtr?

int* myPtr = *myInt;

int* myPtr = myInt;

int* myPtr = &myInt;

int& myPtr = &myInt

1 points   

QUESTION 3

Given the following:

int num1 = 5; //addressed at 1877112

int num2 = 15; //addressed at 1877300

int num3 = 20; //addressed at 1877192

double d1 = 1.05; //addressed at 1374376

double d2 = 2.25; //addressed at 1374360

double d3 = 3.14; //addressed at 1374344

After these statements:

int* ptr1 = &num3

ptr1 = ptr1 + 5;

What will be the address contained in ptr1?

1877192

1877197

1877212

1877220

Unknown – we are not given the storage address of ptr1

1 points   

QUESTION 4

Which of the following statements will allow me to give the value of 10 to the memory int* myPtr points to?

*myPtr = 10;

myPtr = 10;

myPtr *= 10;

myPtr = *10;

1 points   

QUESTION 5

C/C++ has 2 pointer operators, which operator will return the address of variable?

Comma (,)

Asterisk (*)

Ampersand (&)

Semicolon (:)

1 points   

QUESTION 6

C/C++ has 2 pointer operators, which operator represents the name of the address?   (Commonly refer as l-value.)

Comma (,)

Asterisk (*)

Ampersand (&)

Semicolon (:)

1 points   

QUESTION 7

Given this snippet of code, what is the value of z after executing the last statement?

int x = 10, *y, **z;

z = &y;

y = &x;

*y = 100;

10

100

1000

None of the above.

1 points   

QUESTION 8

Given this snippet of code, what is the value of x after executing the last statement?

int x = 10, *y;

y = &x;

y = y + 1;

*y = 100;

10

100

1000

None of the above.

1 points   

QUESTION 9

Given this snippet of code, what is the value of x after executing the last statement?

int x = 10, *y;

y = &x;

*y = 100;

10

100

1000

None of the above.

1 points   

QUESTION 10

A pointer variable can take the address of a memory location as its value. Read the given program.

#include <stdio.h>
main() {
int a = 20, b = 30, *p, *q, **r;
p = &a;
*p = 50;
q = &b;
*q = 70;
r = &p;
**r = 90;
printf("%d ", a); // 1st printf statement
printf("%d ", b); // 2nd printf statement
a = 20;
b = 80;
printf("%d ", **r);    // 3rd printf statement
}

Answer the following three questions.

1.The output of the 1st printf statement is  2030507090.

2. The output of the 2nd printf statement is  2030507090.  

3.The output of the 3rd printf statement  is  2030507090.

3 points   

Click Save and Submit to save and submit. Click Save All Answers to save all answers.

'c'

'P'

'x'

3734351

120

Explanation / Answer

Question1: x

Question2:

int* myPtr = &myInt;


Question 3:

1877197

Question 4:

Question 5:Ampersand

Question 6:Asterik

Question 7:none of the above

Question 8:10

Question 9:100

Question 10:

int* myPtr = &myInt;

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