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

C++ Programming

SIZES MCQs

Total Questions : 10

Question 1.


What would be the output of the following program (in 32-bit systems)?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
cout
  1.    1 4 4
  2.    1 4 8
  3.    1 8 8
  4.    none of the mentioned
 Discuss Question
Answer is Option A. -> 1 4 4

Character is 1 byte, integer 4 bytes and float 4 bytes.

Question 2.


What is the output of the following program?



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

The a as a integer will be converted to float while calculating the size. The value of any variable doesn’t modify inside sizeof operator. Hence value of variable a will remain 5.
Output:
$ g++ size3.cpp
$ a.out
4 5

Question 3.


What is the output of the following program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int num1 = 10;
6.
float num2 = 20;
7.
cout
  1.    2
  2.    4
  3.    8
  4.    garbage
 Discuss Question
Answer is Option B. -> 4

In this program, integer is converted into float. Therefore the result of num1 and num2 is float. And it 

is returning the size of the float.
Output:
$ g++ size2.cpp
$ a.out
4

Question 4.


What is the output of the following program?




1.
#include
2.
using namespace std;
3.
int main ( )
4.
{
5.
static double i;
6.
i = 20;
7.
cout
  1.    4
  2.    2
  3.    8
  4.    garbage
 Discuss Question
Answer is Option C. -> 8

The size of the double data type is 8.
$ g++ size1.cpp
$ a.out
8

Question 5.


What is the output of the following program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int num = 0x20 + 020 + 20;
6.
cout
  1.    2
  2.    4
  3.    Depends on compiler.
  4.    garbage
 Discuss Question
Answer is Option C. -> Depends on compiler.

The sum of three numbers are belongs to different number systems, so the result is typecasted into integer.
Output:
$ g++ size.cpp
$ a.out
4

Question 6.

Identify the incorrect option.


  1.    1
  2.    sizeof(float)
  3.    sizeof(char)
  4.    sizeof(N) = sizeof(signed N) = sizeof(unsigned N)
 Discuss Question
Answer is Option C. -> sizeof(char)

sizeof(char) <= sizeof(wchar_t) <= sizeof(long) 

Question 7.

Size of C++ objects are expressed in terms of multiples of the size of a ____ and the size of a char 

is ____.


  1.    char, 1
  2.    int, 1
  3.    float, 8
  4.    char, 4
 Discuss Question
Answer is Option A. -> char, 1

None.

Question 8.

Implementation dependent aspects about an implementation can be found in ____


 Discuss Question
Answer is Option A. -> char, 1

The limit header holds the details of the machine dependent details.

Question 9.

It is guaranteed that a ____ has atleast 8bits and a ____ has atleast 16 bits.


  1.    int, float
  2.    char, int
  3.    bool, char
  4.    char, short
 Discuss Question
Answer is Option D. -> char, short

None.

Question 10.

The size of an object or a type can be determined using which operator?


  1.    malloc
  2.    sizeof
  3.    malloc
  4.    calloc
 Discuss Question
Answer is Option B. -> sizeof

The sizeof operator gives the size of the object or type.

  • 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 Frequency Of Oscillation At Compared To Earth Will Be

Q.   The Formula In Which Σ(x-x̅)² Is Divided By One Less ....

Q.   If....

Q.   What Is The National Sport Of Canada(in Winter And Summer)?

Q.   A Well-oiled Machinery For The Creation And Diffusion Of Fad....

Q.   Considering All 2-digit Natural Numbers, How Many Values Of ....

Q.   In A Gas Welding Of Mild Steel Using An Oxyacetylene Flame, ....

Q.   Which One Of Following Fuels Is Used By Slow Thermal Nuclear....

Q.   Answer The Questions On The Basis Of The Following Informat....

Q.   Who Discovered The Path Of Circulation Of Blood In The Human....

Q.   __________ Is Produced Using Molasses As The Starting Raw Ma....

Q.   &n....

Q.   `3....

Q.   The Ratio Of Mass Concentration Of Species A To The Total M....

Q.   Which Pesticide Killed Many Other Organisms Instead Of Only ....

Q.   Resolution Of A DVM Is Given By ____________

Q.   Who Has Hinted At The Possible Community Transmission Of The....

Q.   The Ability Of Money To Be Moved Easily Is Called:

Q.   EXORBITANT

Q.   An Inventory, Which Consists Of Partially Worked Goods Is Ca....

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