1
Q:

What is the output of this program?

#include
        using namespace std;
        struct sec {
            int a;
            char b;
        };
        int main()
        {
            struct sec s ={25,50};
            struct sec *ps =(struct sec *)&s;
            cout << ps->a << ps->b;
            return 0;
        }

A) 252 B) 253
C) 254 D) 262

Answer:   A) 252



Explanation:

In this program, We are dividing the values of a and b, printing it.

Subject: C++
Q:

What is the user-defined header file extension in c++?

A) cpp B) h
C) hf D) none of these
 
Answer & Explanation Answer: B) h

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 6350
Q:

What is the general syntax for accessing the namespace variable?

A) namespaceid::operator B) namespace,operator
C) namespace#operator D) none of the mentioned
 
Answer & Explanation Answer: A) namespaceid::operator

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 11973
Q:

What is the use of Namespace?

A) To encapsulate the data B) To structure a program into logical units.
C) Both a and b D) none of these
 
Answer & Explanation Answer: B) To structure a program into logical units.

Explanation:

The main aim of the namespace is to understand the logical units of the program and to make the program so robust.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 3677
Q:

How many types of modularization are there in c++?

A) 4 B) 3
C) 1 D) none of these
 
Answer & Explanation Answer: D) none of these

Explanation:

There are two types of modular programming.They are interface and implementation.

Report Error

View Answer Report Error Discuss

Filed Under: C++

6 10642
Q:

How many types of macros are there in c++?

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: B) 2

Explanation:

There are two types of macros. They are object-like and function-like.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 7037
Q:

which keyword is used to define the macros in c++?

A) macro B) define
C) #define D) none of these
 
Answer & Explanation Answer: C) #define

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: C++

1 5277
Q:

What is the output of this program ?

       #include
        using namespace std;
        int n(char, int);
        int (*p) (char, int) = n;
        int main()
        {
            (*p)('d', 9);
            p(10, 9);
            return 0;
        }
        int n(char c, int i)
        {
            cout << c <<  i;
            return 0;
        }

A) d99 B) d9d9
C) d9 D) compile time error
 
Answer & Explanation Answer: A) d99

Explanation:

In this program, we have declared the values as integer instead of character, So it is printing as d99 but it will not arise an error.

Report Error

View Answer Report Error Discuss

Filed Under: C++

3 15925
Q:

What are the mandatory part to present in function pointers?

A) & B) retrun values
C) data types D) none of these
 
Answer & Explanation Answer: C) data types

Explanation:

The data types are mandatory for declaring the variables in the function pointers.

Report Error

View Answer Report Error Discuss

Filed Under: C++

1 7653