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
  • Floating Point Types

C++ Programming

FLOATING POINT TYPES MCQs

Total Questions : 10

Question 1.

Which is correct with respect to size of the datatypes?


  1.    char > int < float
  2.    int < char > float
  3.    char < int < float
  4.    char < int < double
 Discuss Question
Answer is Option D. -> char < int < double

The char has lesser bytes than int and int has lesser bytes than double whereas int and float 

can potentially have same sizes. 

Question 2.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
float f1 = 0.5;
6.
double f2 = 0.5;
7.
if (f1 == 0.5f)
8.
cout
  1.    equal
  2.    not equal
  3.    compile time error
  4.    runtime error
 Discuss Question
Answer is Option A. -> equal

0.5f results in 0.5 to be stored in floating point representations.
Output:
$ g++ float.cpp
$ a.out
equal

Question 3.

Which is used to indicate single precision value?


  1.    F or f
  2.    L or l
  3.    either a or b
  4.    neither a or b
 Discuss Question
Answer is Option A. -> F or f

None.

Question 4.


What is the output of the following program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
float i = 123.0f;
6.
cout
  1.    123.00
  2.    1.23
  3.    123
  4.    compile time error
 Discuss Question
Answer is Option C. -> 123

The value 123 is printed because of its precision.
$ g++ float.cpp
$ a.out
123

Question 5.


What is the output of this program?



1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
cout
  1.    0.11
  2.    0.10000000000000001
  3.    0.100001
  4.    compile time error
 Discuss Question
Answer is Option B. -> 0.10000000000000001

The double had to truncate the approximation due to it’s limited memory, which resulted in a number 

that is not exactly 0.1.
Output:
$ g++ float2.out
$ a.out
0.10000000000000001

Question 6.

Which of the following is a valid floating point literal?


  1.    f287.333
  2.    F287.333
  3.    287.e2
  4.    287.3.e2
 Discuss Question
Answer is Option C. -> 287.e2

To make a floating point literal, we should attach a suffix of ‘f’ or ‘F’ and there should not be any 

blank space.

Question 7.

What is the range of the floating point numbers?


  1.    -3.4E+38 to +3.4E+38
  2.    -3.4E+38 to +3.4E+34
  3.    -3.4E+38 to +3.4E+36
  4.    -3.4E+38 to +3.4E+32
 Discuss Question
Answer is Option A. -> -3.4E+38 to +3.4E+38

None.

Question 8.


What is the output of this program?



1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
float num1 = 1.1;
6.
double num2 = 1.1;
7.
if (num1 == num2)
8.
cout
  1.    harvard
  2.    stanford
  3.    compile time error
  4.    runtime error
 Discuss Question
Answer is Option A. -> harvard

Float store floating point numbers with 8 place accuracy and requires 4 bytes of Memory. Double 

has 16 place accuracy having size of 8 bytes.
Output:
$ g++ float3.cpp
$ a.out
harvard

Question 9.

Which of the following is not one of the sizes of the floating point types?


  1.    short float
  2.    float
  3.    long double
  4.    double
 Discuss Question
Answer is Option A. -> short float

Floating point types occur in only three sizes-float, long double and double.

Question 10.

Which of three sizes of floating point types should be used when extended precision is required?


  1.    float
  2.    double
  3.    long double
  4.    extended float
 Discuss Question
Answer is Option C. -> long double

Float for single precision, double for double precision and long double for extended precision.

  • 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

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

Recent Questions

Q.   The Enzymes That Catalyze The Reactions Of The Krebs Cycle A....

Q.   IC Counters Are

Q.   Synonym Of PROMULGATE

Q.   ______bridge Measures The Unknown Inductance By Comparing It....

Q.   An Imaginary Number Is One That Exists Only In The Mind Of T....

Q.   The Following System Is Not Generally Used

Q.   Exposure To Chemicals Having Carcinogenic Properties Cause

Q.   Determine Output: Void Main() { Int I=0, J=1, K=2, M; M = I+....

Q.   Sulfanilamide Was Synthesized By Which Of The Following Rese....

Q.   The Personnel Which Deal With The Computer And Its Managemen....

Q.   What Is The Detention Time Considered For The Contact Zone W....

Q.   A, B Can Do A Piece Of Work In 30 Days , While B Can C Do Th....

Q.   Identify The Exact Answer For The Blank (2)?

Q.   Thermosetting Polymers As Compared To Thermoplastic Polymers....

Q.   Where Did Last World Cup Soccer Tournament Took Place (2010)....

Q.   Recently, The Lancet Medical Journal Has Published Its New R....

Q.    what Is The Length Of A Square I Its Perimeter Is 160 Cm. ....

Q.   Which Of These Methods Of Httpd Class Is Used To Read Data F....

Q.   Coolant Present In The Primary Circuit Of A Pressurised Wate....

Q.   What Is The Father Of A Calf Called?

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