
C++ Pointers and Memory Management Quiz

Quiz
•
Information Technology (IT)
•
University
•
Hard
MAHANI BINTI ZAKARIA (POLIMAS)
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following correctly declares a pointer to an integer in C++?
int pointer;
int *pointer;
pointer int*;
int &pointer;
Answer explanation
To declare a pointer to an integer, we use after the data type: int pointer;. This means pointer can store the memory address of an integer.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
num
10
ptr
&num
Answer explanation
To declare a pointer to an integer, we use after the data type: int pointer;. This means pointer can store the memory address of an integer.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which operator is used to get the address of a variable in C++?
*
&
@
#
Answer explanation
The ampersand (&) is used to get the memory address of a variable. For example, &x gives the address of variable x.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the relationship between a pointer and an array in C++?
Pointers cannot access array elements.
A pointer can point to only the last element of the array.
Array name is a constant pointer to the first element.
Arrays do not work with pointers.
Answer explanation
In C++, the name of the array acts like a pointer to the first element. That’s why you can use pointer arithmetic to access array elements.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the new and delete operators in C++?
To perform multiplication and division.
To create and remove functions.
To allocate and free memory during runtime.
To declare variables.
Answer explanation
The new operator is used to allocate memory dynamically (during program running time), and delete is used to free that memory when it is no longer needed.
Similar Resources on Wayground
10 questions
Herança e Polimorfismo em Java

Quiz
•
University
10 questions
Kuis Informatika kela X

Quiz
•
10th Grade - University
10 questions
Data Visualization and Exploration Quiz

Quiz
•
University
10 questions
Basic C Programming

Quiz
•
University
5 questions
Data Structures_QUIZ-1_18022025

Quiz
•
University
10 questions
Типы данных. Переменные. Операции в Java

Quiz
•
University
10 questions
Цикл for

Quiz
•
University
10 questions
Ice Breaking Informatika

Quiz
•
10th Grade - University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University