ECE431 - Pointer & Reference

ECE431 - Pointer & Reference

University

16 Qs

quiz-placeholder

Similar activities

Linux 3-4

Linux 3-4

University

20 Qs

PSC Quiz1

PSC Quiz1

University - Professional Development

20 Qs

Quiz 2

Quiz 2

University

12 Qs

Algo Duel

Algo Duel

University

20 Qs

Pointers

Pointers

University

11 Qs

Data Structures

Data Structures

University

20 Qs

Programming in C(1)

Programming in C(1)

University

20 Qs

C++ Lambda Expression

C++ Lambda Expression

University - Professional Development

20 Qs

ECE431 - Pointer & Reference

ECE431 - Pointer & Reference

Assessment

Quiz

Computers

University

Hard

Created by

Dr Zaini

Used 1+ times

FREE Resource

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;

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?