
C++ Pointers and Memory Management Quiz
Authored by MAHANI BINTI ZAKARIA (POLIMAS)
Information Technology (IT)
University
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
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.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Sem 2 IT Test 1
Quiz
•
12th Grade - University
10 questions
Quiz on Basics of C
Quiz
•
University
10 questions
Esri Fun Quiz!
Quiz
•
University
10 questions
Quiz - Foundation of Testing (Testing and System Implementation)
Quiz
•
University
10 questions
Review - Software Engineering
Quiz
•
University
10 questions
Mastering Microsoft OneDrive Basics
Quiz
•
12th Grade - University
10 questions
AI and Machine Learning Quiz
Quiz
•
University
10 questions
Quizzi bài 29 Tin học 10
Quiz
•
10th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
29 questions
Alg. 1 Section 5.1 Coordinate Plane
Quiz
•
9th Grade
22 questions
fractions
Quiz
•
3rd Grade
11 questions
FOREST Effective communication
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
7 questions
Fragments, Run-ons, and Complete Sentences
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
10 questions
DNA Structure and Replication: Crash Course Biology
Interactive video
•
11th Grade - University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
5 questions
Examining Theme
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University