LakshyaEducation.in

VEDIC MATHS Video Series
  • Home
  • Video Series
    • Vedic Maths Videos
    • Quantitative Aptitude Videos
    • Class 8 Maths Videos
    • Class 9 Maths Videos
    • Class 10 Maths Videos
  • Quiz & Solutions
  • Blog
  • Store
  • Login
  • Contact Us
  • Home
  • Topic
  • C++ Programming
  • Dereferencing

C++ Programming

DEREFERENCING MCQs

Total Questions : 10

Question 1.

Pick out the correct statement.


  1.    The NULL pointer dereference occurs where a pointer that is expected to be a valid address but instead is equal to NULL.
  2.    The NULL pointer dereference occurs where a pointer that is expected to be a valid address but instead is equal to memory address.
  3.    both a & b
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> The NULL pointer dereference occurs where a pointer that is expected to be a valid address but instead is equal to NULL.

None.

Question 2.

What does the dereference operator will return?


  1.    rvalue equivalent to the value at the pointer address.
  2.    lvalue equivalent to the value at the pointer address.
  3.    it will return nothing
  4.    none of the mentioned
 Discuss Question
Answer is Option B. -> lvalue equivalent to the value at the pointer address.

It operates on a pointer variable, and returns an l-value equivalent to the value at the pointer address.

Question 3.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
double arr[] = {5.0, 6.0, 7.0, 8.0};
6.
double *p = (arr+2);
7.
cout
  1.    rvalue equivalent to the value at the pointer address.
  2.    lvalue equivalent to the value at the pointer address.
  3.    it will return nothing
  4.    none of the mentioned
 Discuss Question
Answer is Option B. -> lvalue equivalent to the value at the pointer address.

Answer:(a)
Explanation:
In this program, We are printing the values that are pointed by pointer and also the dereference oerator.
Output:
$ g++ def5.cpp
$ a.out
7
0xbf99fc98
8
5
14

Question 4.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x = 9;
6.
int* p = &x;
7.
cout
  1.    4
  2.    2
  3.    Depends on compiler
  4.    none of the mentioned
 Discuss Question
Answer is Option C. -> Depends on compiler

The size of a datatype mainly depends on complier only.
Output:
$ g++ def3.cpp
$ a.out
4

Question 5.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main ()
4.
{
5.
int a;
6.
int * ptr_b;
7.
int ** ptr_c;
8.
a = 1;
9.
ptr_b = &a;
10.
ptr_c = &ptr_b;
11.
cout
  1.    4
  2.    2
  3.    Depends on compiler
  4.    none of the mentioned
 Discuss Question
Answer is Option C. -> Depends on compiler

Answer: (a)
Explanation:
In this program, We are printing the values and memory address
by using the pointer and derefernce operator.
Output:
$ g++ def2.cpp
$ a.out
1
1
0xbffc9924
1

Question 6.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x;
6.
int *p;
7.
x = 5;
8.
p = &x;
9.
cout
  1.    5
  2.    10
  3.    memory address
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> 5

In this program, we are copying the memory location of x into p and then printing the value in 

the address.
Output:
$ g++ def1.cpp
$ a.out
5

Question 7.

Pick out the correct option.


  1.    References automatically dereference without needing an extra character.
  2.    References automatically dereference with an extra character.
  3.    Reference will not dereference
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> References automatically dereference without needing an extra character.

None.

Question 8.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a, b;
6.
int* c;
7.
c = &a;
8.
a = 200;
9.
b = 200;
10.
*c = 100;
11.
b = *c;
12.
cout
  1.    100 200
  2.    100 0
  3.    200 200
  4.    100 100
 Discuss Question
Answer is Option D. -> 100 100

In this program, We are making the assignments and invoking the both b and c values as 100 

by dereference operator.
Output:
$ g++ def.cpp
$ a.out
100 100

Question 9.

Which is used to tell the COMPUTER that where a pointer is pointing to?


  1.    dereference
  2.    reference
  3.    heap operations
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> dereference

None.

Question 10.

Which is used to do the dereferencing?


  1.    pointer without asterix
  2.    value without asterix
  3.    pointer with asterix
  4.    value with asterix
 Discuss Question
Answer is Option C. -> pointer with asterix

Derefencing is using a pointer with asterix. For example, *(abc).

  • Share on Facebook!
  • Share on Pinterest!

Sub Topics

  • Abstract Classes
  • Access Control
  • Argument Passing
  • Arrays
  • Booleans
  • C++ Concepts
  • Catching Exceptions
  • Character Types
  • Class Hierarchies And Abstract Classes
  • Class Hierarchies Introduction
  • Classes
  • Comments And Indentation
  • Complex Number Type
  • Constants
  • Constructors And Destructors
  • Container Design
  • Conversion Operators
  • Declaration
  • Default Arguments
  • Dereferencing
  • Derivation And Templates
  • Derived Classes
  • Design Of Class Hierarchies
  • Enumerations
  • Error Handling
  • Error Handling Alternatives
  • Essential Operators
  • Exception Specifications
  • Exceptions
  • Exceptions And Efficiency
  • Exceptions That Are Not Errors
  • Floating Point Types
  • Free Store
  • Friends
  • Function Call
  • Function Declarations
  • Function Templates
  • Functions
  • Grouping Of Exceptions
  • Header Files Usage
  • Increment And Decrement
  • Integer Types
  • Large Objects
  • Linkage
  • Macros
  • Modularization And Interfaces
  • Multiple Inheritance
  • Namespaces
  • Objects
  • Objects And Classes
  • Oops Concepts
  • Operator Functions
  • Operators
  • Overloaded Function Names
  • Pointer To Function
  • Pointer To Void
  • Pointers
  • Pointers Into Arrays
  • Pointers To Members
  • References
  • Resource Management
  • Run Time Type Information
  • Sequence Adapters
  • Sequences
  • Simple String Template
  • Sizes
  • Specialization
  • Standard Exceptions
  • Standard Library Design
  • Statements
  • String Class
  • Structures
  • Subscripting
  • Template Arguments To Specify Policy Usage
  • Types
  • Uncaught Exceptions
  • Unspecified Number Of Arguments
  • User Defined Types
  • Value Return
  • Vector
  • Void

Recent Posts

  • Sail E0 Results 2022
  • Vedic Maths Faq
  • Best Ssc Exam For Girls
  • Is Ssc Difficult Than Upsc?
  • Quantitative Aptitude Faqs
  • Ssc Exam Guide Book
  • Sail E0 Exam Results Cancelled - Exam Will Be Rescheduled

Recent Questions

Q.   Which Of The Following Methods Can Be Used For Manufacturing....

Q.   Bromine Is A

Q.   The Branch Current Method Is Based On Kirchhoff's Voltage La....

Q.   Which Is The Shortcut Key To Jump To The First Slide Of The ....

Q.   The Earliest Known Epigraphic Evidence Of Bhagvatism Is

Q.    the Average Of First 10 Odd Numbers Is?

Q.   Who Was The Architect Who Designed "Taj Mahal" ?

Q.   Antonym Of Supernal ?

Q.   The Arranging Of Data In A Logical Sequence Is Called

Q.   Gopal Krishna Gokhale

Q.   After You Wet Your Hands You Should Apply ______ And _____ F....

Q.   The Practical Limit Of Moisture Content Achieved In Air Dryi....

Q.   The Sieder-Tate Correlation For Heat Transfer In Turbulent F....

Q.   Which Of The Following Is Not A Measure Of Product Deficienc....

Q.   After Choosing A Predefined Template, Which Option Has To Be....

Q.   Who Has Won The Best Actor Award At The 67th National Awards....

Q.   The Rails Get Out Of Their Original Positions Due To Insuffi....

Q.   The Unit Of Pressure Most Commonly Found On A Surface Weathe....

Q.   The Charging Time Constant Of A Circuit Consisting Of An Ind....

Q.   Which Of Following Is First Sign Of Colorectal Cancer?

Topics

Computer Aptitude
SAIL Junior Officer (E-0)
10th Grade
11th Grade
12th Grade
4th Grade
5th Grade
6th Grade
7th Grade
8th Grade
9th Grade
NCERT
Cat
Commerce
Computer Science
Engineering
English
General Knowledge
Ias
Management
Quantitative Aptitude
Reasoning Aptitude
General Studies (Finance And Economics)
Vedic Maths
Analytical Instrumentation
Biochemistry
Bioinformatics
Biology
Biotechnology
Bitsat
Business Statistics
C Programming
C++ Programming
Cell Biology
Chemistry
Cost Accounting
Drug And Pharmaceutical Biotechnology
Electrical Measurement And Instrumentation
Environment Management
Environmental Biotechnology
Enzyme Technology
Financial Management And Financial Markets
Gate
General Science
Geography
Heat Transfer
History And National Movements
Human Anatomy And Physiology
Human And Cultural Diversity
Human Resource Management
Indian Economy
Indian Geography
Indian History
Indian Polity
Instrumentation Transducers
International Relations
Life Sciences
Marketing And Marketing Management
Mass Transfer
Mechanics Of Materials
Microbiology
Neet
Professional Communication
Renewable Energy
Sociology
Surveying
Total Quality Management
Uidai Aadhaar Supervisor Certification
Virology
LakshyaEducation.in
Lakshya Education
Bhilai,Chattisgarh,India
Email: admin@lakshyaeducation.in Phone: 07893519977 (WhatsApp)

Quick Links

  • Vedic Maths
  • Quantitative Aptitude
  • Class – IX Maths
  • Class – X Maths
  • Blog

Our Services

  • About us
  • Privacy
  • TOS
  • Refund / Cancellation
  • Contact
  • Affiliate Program
  • Copyright © 2022 All Right Reserved | Lakshya Education     ( )
    Login / Register

    Your Account will be created automatically when you click the below Google or Facebook Login Button.
    •   Login With Facebook
    •  Login With Google
     Login With Email/Password