Sail E0 Webinar

MCQs

Total Questions : 7
Question 1.

Which is used to use a function from one source file to another?


  1.    code
  2.    declaration
  3.    prototype
  4.    none of the mentioned
 Discuss Question
Answer: Option C. -> prototype

By defining a function's prototype in another file means, we can inherit all the features 

from the source function.



Question 2.

What is the use of no linkage?


  1.    make the entity visible to other programs
  2.    make the entity visible to other blocks in the same program.
  3.    make the entity visible only to that block
  4.    none of the mentioned
 Discuss Question
Answer: Option C. -> make the entity visible only to that block

None.


Question 3.

To use external linkage we have to use which keyword?


  1.    static
  2.    extern
  3.    const
  4.    none of the mentioned
 Discuss Question
Answer: Option B. -> extern

extern keyword is used to represent identifiers from other programs.


Question 4.

What is the defualt type oof linkage that are available for identifires?


  1.    internal
  2.    external
  3.    no linkage
  4.    none of the mentioned
 Discuss Question
Answer: Option B. -> external

None.


Question 5.


What will be the output of these two programs?



1.


1.
1.
#ifndef Exercise_H
2.
#define Exercise_H
3.
int num = 842;
4.
#endif


2.


1.
#include
2.
#include "exe.h"
3.
using namespace std;
4.
int main(int argc, char * argv[] )
5.
{
6.
cout
  1.    842
  2.    843
  3.    compile time error
  4.    none of the mentioned
 Discuss Question
Answer: Option A. -> 842

In this program, we have created a header file and linked that into the source program and we 

are post incrementing that because of that it is printed as 842.
Output:
$ g++ link.cpp
$ a.out
842


Question 6.

To use internal linkage we have to use which keyword?


  1.    static
  2.    extern
  3.    static or extern
  4.    none of the mentioned
 Discuss Question
Answer: Option A. -> static

None.


Question 7.

How any types of linkage are there in c++?


  1.    1
  2.    2
  3.    3
  4.    4
 Discuss Question
Answer: Option C. -> 3

There are three types of linkage in c++. They are internal linkage, external linkage and 

no linkage.


Latest Videos

Latest Test Papers