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

C++ Programming

OPERATORS MCQs

Total Questions : 10

Question 1.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
main()
4.
{
5.
double a = 21.09399;
6.
float b = 10.20;
7.
int c ,d;
8.
c = (int) a;
9.
d = (int) b;
10.
cout
  1.    20 10
  2.    10 21
  3.    21 10
  4.    none of the mentioned
 Discuss Question
Answer is Option C. -> 21 10

In this program, we are casting the operator to integer, So it is printing as 21 and 10
Output:
$ g++ op5.cpp
$ a.out
21 10

Question 2.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5, b = 6, c;
6.
c = (a > b) ? a : b;
7.
cout
  1.    6
  2.    5
  3.    4
  4.    7
 Discuss Question
Answer is Option A. -> 6

Here the condition is false on conditional operator, so the b value is assigned to c.
Output:
$ g++ op1.cpp
$ a.out
6

Question 3.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main ()
4.
{
5.
int x, y;
6.
x = 5;
7.
y = ++x * ++x;
8.
cout
  1.    749736
  2.    736749
  3.    367497
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> 749736

Because of the precedence the pre-increment and post increment operator, we got the output 

as 749736.
Output:
$ g++ op.cpp
$ a.out
749736

Question 4.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int i, j;
6.
j = 10;
7.
i = (j++, j + 100, 999 + j);
8.
cout
  1.    1000
  2.    11
  3.    1010
  4.    1001
 Discuss Question
Answer is Option C. -> 1010

:j starts with the value 10. j is then incremented to 11. Next, j is added to 100. Finally, j 

(still containing 11) is added to 999 which yields the result 1010.
Output:
$ g++ op2.cpp
$ a.out
1010

Question 5.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a = 5, b = 6, c, d;
6.
c = a, b;
7.
d = (a, b);
8.
cout
  1.    5 6
  2.    6 5
  3.    6 7
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> 5 6

It is a separtor here.In c,the value a is stored in c and in d the value b is stored in d because of 

the bracket.
Output:
$ g++ op3.cpp
$ a.out
5 6

Question 6.

What is the use of dynamic_cast operator?


  1.    it converts virtual base class to derived class
  2.    it converts virtual base object to derived objeccts
  3.    it will convert the operator based on precedence
  4.    None of the mentioned
 Discuss Question
Answer is Option A. -> it converts virtual base class to derived class

 Because the dynamic_cast operator is used to convert from base class to derived class.

Question 7.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a;
6.
a = 5 + 3 * 5;
7.
cout
  1.    35
  2.    20
  3.    25
  4.    30
 Discuss Question
Answer is Option B. -> 20

Because the * operator is having highest precedence, So it is executed first and then the + operator 

will be executed.
Output:
$ g++ op1.cpp
$ a.out
20

Question 8.

Which operator is having right to left associativity in the following?


  1.    Array subscripting
  2.    Function call
  3.    Addition and subtraction
  4.    Type cast
 Discuss Question
Answer is Option D. -> Type cast

None

Question 9.

What is this operator called ?: ?


  1.    conditional
  2.    relational
  3.    casting operator
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> conditional

In this operator, if the condition is true means, it will return the first operator, otherwise second operator.

Question 10.

Which operator is having the highest precedence?


  1.    postfix
  2.    unary
  3.    shift
  4.    equality
 Discuss Question
Answer is Option A. -> postfix

The operator which is having highest precedence is postfix and lowest is equality.

  • 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

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

Recent Questions

Q.   The Mortar In Which Both Cement And Lime Are Used As Binding....

Q.   In....

Q.   High Temperature In Gasification Of Coal Favours

Q.   The __________ Engines Can Work On Very Lean Mixture Of Fuel....

Q.   Ch....

Q.   Purification Of Blood Takes Place In

Q.   What Is The Minimum Vapour Pressure (in KPa) Of The Working ....

Q.   The Kaposi’s Sarcoma Is Caused By ____________________

Q.   Neutral Atmosphere Is Maintained In A/an __________ Furnace.....

Q.   Raju Has 14 Currency Notes In His Pocket Consisting Of Only....

Q.   " You Are Thinking Very Highly About Ravi But He Is Not....

Q.   The Range Of Electromagnetic Spectrum Important In Heat Tran....

Q.   Th....

Q.   January : November : : Sunday : ?

Q.   Consider The Following Statements.There Are 25 High Courts I....

Q.   T....

Q.   In Which Type Of Sedimentation, The Flocculent Suspension Of....

Q.   Hardening Of Metal Is Due To Heating To A Particular Temper....

Q.   Which Of The Following Materials Has The Highest Electrical ....

Q.   ....

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
  • YouTube Channel
  • Maths Fast Trick
  • 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