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
  • Pointers

C++ Programming

POINTERS MCQs

Total Questions : 10

Question 1.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char *ptr;
6.
char Str[] = "abcdefg";
7.
ptr = Str;
8.
ptr += 5;
9.
cout
  1.    fg
  2.    cdef
  3.    defg
  4.    abcd
 Discuss Question
Answer is Option A. -> fg

Pointer ptr points to string ‘fg’. So it prints fg.
Output:
$ g++ point.cpp
$ a.out
fg

Question 2.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char arr[20];
6.
int i;
7.
for(i = 0; i < 10; i++)
8.
*(arr + i) = 65 + i;
9.
*(arr + i) = '\0';
10.
cout
  1.    ABCDEFGHIJ
  2.    AAAAAAAAAA
  3.    JJJJJJJJ
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> ABCDEFGHIJ

Each time we are assigning 65 + i. In first iteration i = 0 and 65 is assigned. So it will print from A to J.
$ g++ point1.cpp
$ a.out
ABCDEFGHIJ

Question 3.

The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char 

and returns a pointer to a pointer to a integer is


  1.    int **fun(float**, char**)
  2.    int *fun(float*, char*)
  3.    int ***fun(float*, char**)
  4.    int ***fun(*float, **char)
 Discuss Question
Answer is Option C. -> int ***fun(float*, char**)

None.

Question 4.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5, b = 10, c = 15;
6.
int *arr[ ] = {&a, &b, &c};
7.
cout
  1.    5
  2.    10
  3.    15
  4.    it will return some random number
 Discuss Question
Answer is Option D. -> it will return some random number

Array element cannot be address of auto variable. It can be address of static or extern variables.

Question 5.

What will happen in this code?
 int a = 100, b = 200;
 int *p = &a, *q = &b;
 p = q;


  1.    b is assigned to a
  2.    p now points to b
  3.    a is assigned to b
  4.    q now points to a
 Discuss Question
Answer is Option B. -> p now points to b

Assigning to refrence changes the object to which the refrence is bound.

Question 6.

Which of the following is illegal?


  1.    int *ip;
  2.    string s, *sp = 0;
  3.    int i; double* dp = &i;
  4.    int *pi = 0;
 Discuss Question
Answer is Option C. -> int i; double* dp = &i;

dp is initialized int value of i.

Question 7.

Choose the right option
 string* x, y;


  1.    x is a pointer to a string, y is a string
  2.    y is a pointer to a string, x is a string
  3.    both x and y are pointer to string types
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> x is a pointer to a string, y is a string

* is to be grouped with the variables not the data types.

Question 8.

What does the following statement mean?
 int (*fp)(char*)


  1.    pointer to a pointer
  2.    pointer to an array of chars
  3.    pointer to function taking a char* argument and returns an int
  4.    function taking a char* argument and returning a pointer to int
 Discuss Question
Answer is Option C. -> pointer to function taking a char* argument and returns an int

None.

Question 9.

The operator used for dereferencing or indirection is ____


  1.    *
  2.    &
  3.    ->
  4.    ->>
 Discuss Question
Answer is Option A. -> *

None.

Question 10.

Which one of the following is not a possible state for a pointer.


  1.    hold the address of the specific object
  2.    point one past the end of an object
  3.    zero
  4.    point to a tye
 Discuss Question
Answer is Option D. -> point to a tye

A pointer can be in only 3 states a,b and c.

  • 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

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

Recent Questions

Q.   According To The Affordable Care Act, Children Can Be On The....

Q.   A Truncated Polypeptide Is Synthesized Due To A Nonsense Mut....

Q.   How Do The British Economists And Political Scientists React....

Q.   Which Of The Following Is Not A Product Of Anaerobic Digesti....

Q.   The Ratio For The Rate Of Washing To The Final Rate Of Filtr....

Q.   To Turn On UJT, The Forward Bias On The Emitter Diode Should....

Q.   Which Of The Following IR Radiation Is Used In Measuring Rel....

Q.   The Hottest Part Of The Gas Flame Is Known As

Q.   Ethyl Alcohol Cannot Be Produced

Q.   Which Of The Following Can Be Correct Conclusion Drawn From ....

Q.   ISS Is Less Sensitive Than Which Of The Following?

Q.   Which Of The Following Is The Most Effective Inhibitor Of Gr....

Q.   A Metallic Alloy In Which One Of The Constituent Metal Is __....

Q.   Defense Department Analysts Worry That The Ability Of The Un....

Q.   S1: If You Want To Do Well In Your Examinations You Need To ....

Q.   Which One Of The Following Is Also Known As Solution ?

Q.   (0.1667)(0.8333)(0.3333) Is Approximately Equal To: ....

Q.   IR Is The Study Of

Q.    if The Radius Of A Sphere Is Increased By 2 Cm, Then Its S....

Q.   Statement I: When Water Is Heated, We See bubbles In It....

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)
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