Search Header Logo

ECE431 - Pointer & Reference

Authored by Dr Zaini

Computers

University

Used 1+ times

ECE431 - Pointer & Reference
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does int* ptr = &num do?

Declares an integer

Stores the value of num

Declares a pointer to num

Assigns the value num to ptr

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If x = 5 and int* px = &x;
what does *px return?

5

Memory address of x

Error

Undefined value

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the statement *mark = 40; do, if mark is a pointer to an integer?

Stores 40 in a new location

Changes the address mark is pointing to

Changes the value at the pointed location to 40

Causes a segmentation fault

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of: int score = 88; int* pScore = &score; *pScore = 90; cout << score;

88

90

Error

Address of score

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which operator is used to declare a pointer?

&

*

%

^

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of &temp in int* p = &temp;?

Declare a new pointer

Get the value of temp

Get the address of temp

Initialize temp

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which line declares a reference / alias correctly?

int ref = *val;

int* ref = val;

int& ref = val;

int& ref = &val;

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers