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

What is output by the following code segment? int i; for (i = 0; i < 10; i++) i

ID: 3570514 • Letter: W

Question

What is output by the following code segment?

int i;

     for (i = 0; i < 10; i++)

          i += 3;

          i = 3;

     cout<<i;

A. 1                         D. 3

B. 12                       E. 9

C. 13

2.

Memory addresses are expressed as ______

A.decimal numbers

B.octal numbers

C.binary numbers

D.hexadecimal numbers

E.duodecimal numbers

3.

What is output by the following code segment?

          int *ptr1;

          int A = 5;

          ptr1 = &A;

          cout << 5 * *ptr1<<endl;

A.5 times the memory address for A

B.5 times the memory address for prt1

C.5

D.25

E.It does not compile

4.

Which of the following would correctly store the address of the variable ABC in the pointer variable PTR (assume data types are correct)?

A.PTR = *ABC;

B.ABC = &PTR;

C.*PTR = ABC;

D.PTR = &ABC;

E.&ABC = PTR;

5.

Given the array declaration
      int bat [] = {1, 34, 23, 98, 7, 52, 91, 72, 86, 45};
what would be output by the statement
     cout<< *(bat + 4);

A.7

B.23

C.98

D.52

E.1

Thanks

Explanation / Answer

1. D. 3

2. D.hexadecimal numbers

3. D.25

4. D. PTR = &ABC;

5. A. 7

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