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 C# Programming Java Programming
Microbiology Biochemistry Biotechnology Biochemical Engineering
Civil Engineering Mechanical Engineering Chemical Engineering 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 - Functions

@ : Home > C++ Programming > Functions > Programs

Exercise

"Example is better than precept."
- (Proverb)
1. 

What will be the output of the following program?

#include<iostream.h>
long BixFunction(int x, int y = 5, float z = 5)
{
    return(++x * ++y + (int)++z);
}
int main()
{
    cout<< BixFunction(20, 10); 
    return 0;
}

A. 237
B. 242
C. 240
D. 35
E. The program will report error on compilation.

2. 

What will be the output of the following program?

#include<iostream.h>
int BixFunction(int a, int b = 3, int c = 3)
{
    cout<< ++a * ++b * --c ; 
    return 0;
}
int main()
{
    BixFunction(5, 0, 0); 
    return 0;
}

A. 8B. 6
C. -6D. -8

3. 

What will be the output of the following program?

#include<iostream.h> 
void MyFunction(int a, int b = 40)
{
    cout<< " a = "<< a << " b = " << b << endl;
}
int main()
{
    MyFunction(20, 30);
    return 0; 
}

A. a = 20 b = 40
B. a = 20 b = 30
C. a = 20 b = Garbage
D. a = Garbage b = 40

4. 

Which of the following statement is correct about the program given below?

#include<iostream.h> 
static int b = 0; 
void DisplayData(int *x, int *y = &b)
{
    cout<< *x << " " << *y;
}
int main()
{
    int a = 10, b = 20 ;
    DisplayData(&a, &b);
    return 0; 
}

A. The program will print the output 10 20.
B. The program will print the output 10 0.
C. The program will print the output 10 garbage.
D. The program will report compile time error.

5. 

What will be the output of the following program?

#include<iostream.h> 
typedef void(*FunPtr)(int);
int Look(int = 10, int = 20);
void Note(int); 
int main()
{
    FunPtr ptr = Note;
    (*ptr)(30); 
    return 0;
}
int Look(int x, int y)
{
    return(x + y % 20);
}
void Note(int x)
{
    cout<< Look(x) << endl;
}

A. 10
B. 20
C. 30
D. 40
E. Compilation fails.



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

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