IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C# Programming Java Programming
Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - Floating Point Issues

@ : Home > C Programming > Floating Point Issues > Find Output of Program

Exercise

"We cannot solve our problems with the same thinking we used when we created them."
- Albert Einstein
1. 

What will be the output of the program?

#include<stdio.h>
int main()
{
    float a=0.7;
    if(a < 0.7)
        printf("C\n");
    else
        printf("C++\n");
    return 0;
}

A. CB. C++
C. Compiler errorD. Non of above

2. 

What will be the output of the program?

#include<stdio.h>
int main()
{
    float *p;
    printf("%d\n", sizeof(p));
    return 0;
}

A. 2 in 16bit compiler, 4 in 32bit compiler
B. 4 in 16bit compiler, 2 in 32bit compiler
C. 4 in 16bit compiler, 4 in 32bit compiler
D. 2 in 16bit compiler, 2 in 32bit compiler

3. 

What will be the output of the program?

#include<stdio.h>
int main()
{
    float fval=7.29;
    printf("%d\n", (int)fval);
    return 0;
}

A. 0B. 0.0
C. 7.0D. 7

4. 

What will be the output of the program?

#include<stdio.h>
#include<math.h>
int main()
{
    printf("%f\n", sqrt(36.0));
    return 0;
}

A. 6.0B. 6
C. 6.000000D. Error: Prototype sqrt() not found.

5. 

What will be the output of the program?

#include<stdio.h>
#include<math.h>
int main()
{
    printf("%d, %d, %d\n", sizeof(3.14f), sizeof(3.14), sizeof(3.14l));
    return 0;
}

A. 4, 4, 4B. 4, 8, 8
C. 4, 8, 10D. 4, 8, 12


© 2008-2011 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Advertise     Contact us: info@indiabix.com     Follow us on twitter!