Exercise: Python

Questions for: Functions

What will be the output of the following program?
#include<iostream.h> 
class ExamAdept
{
    int Num; 
    public:
    ExamAdept(int x)
    {
        Num = x;
    }
    int BixFunction(void);
};
int ExamAdept::BixFunction(void)
{
    static int Sum = 0; 
    int Dec;
    Dec = Num % 10; 
    Num = Num / 10; 
    if((Num / 100)) BixFunction(); 
    Sum  = Sum * 10 + Dec; 
    return Sum;
}
int main()
{
    ExamAdept objBix(12345);
    cout<< objBix.BixFunction();
    return 0; 
}
A:
123
B:
321
C:
345
D:
12345
Answer: C
No answer description is available. Let's discuss.
What will be the output of the following program?
#include<iostream.h> 
class TestDrive
{
    int x; 
    public:
    TestDrive(int xx)
    {
        x = xx;
    }
    int DriveIt(void);
};
int TestDrive::DriveIt(void)
{
    static int value = 0;
    int m;
    m = x % 2;
    x = x / 2;
    if((x / 2)) DriveIt(); 
    value = value + m * 10; 
    return value;
}
int main()
{
    TestDrive TD(1234);
    cout<< TD.DriveIt() * 10 << endl;
    return 0; 
}
A:
300
B:
200
C:
Garbage value
D:
400
Answer: D
No answer description is available. Let's discuss.
What will be the output of the following program?
#include<iostream.h> 
class ExamAdept
{
    int K; 
    public:
    void BixFunction(float, int , char);
    void BixFunction(float, char, char);
    
};
int main()
{
    ExamAdept objIB;
    objIB.BixFunction(15.09, 'A', char('A' + 'A'));
    return 0;
}
void ExamAdept::BixFunction(float, char y, char z)
{
    K = int(z);
    K = int(y);
    K = y + z;
    cout<< "K = " << K << endl; 
}
A:
The program will print the output M = 130.
B:
The program will print the output M = 195.
C:
The program will print the output M = -21.
D:
The program will print the output M = -61.
Answer: D
No answer description is available. Let's discuss.
Which of the following statement is correct about the program given below?
#include<iostream.h> 
class ExamAdept
{
    private:
    int AdditionOne(int x, int y = 1) 
    {
        return x * y;
    }
     
    public:
    int AdditionTwo(int x, int y = 1)
    {
        return x / y;
    } 
}; 
int main()
{
    ExamAdept objBix;
    cout<<objBix.AdditionOne(4, 8)<<" "; 
    cout<<objBix.AdditionTwo(8, 8); 
    return 0;
}
A:
The program will print the output 32 0.
B:
The program will print the output 32 garbage-value.
C:
The program will print the output 32 1.
D:
The program will report compile time error.
Answer: D
No answer description is available. Let's discuss.
What will be the output of the following program?
#include<iostream.h> 
class Bix
{
    int x, y; 
    public:
    void show(void);
    void main(void);
};
void Bix::show(void)
{ 
    Bix b;
    b.x = 2;
    b.y = 4;
    cout<< x << " " << y;
}
void Bix::main(void)
{
    Bix b;
    b.x = 6; 
    b.y = 8;
    b.show();
}
int main(int argc, char *argv[])
{
    Bix run;
    run.main();
    return 0; 
}
A:
2 4
B:
6 8
C:
The program will report error on Compilation.
D:
The program will report error on Linking.
Answer: B
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz