Sail E0 Webinar

MCQs

Total Questions : 66 | Page 1 of 7 pages
Question 1.

Is it true that a function may have several declarations, but only one definition?


  1.    Yes
  2.    No
 Discuss Question
Answer: Option A. -> Yes

Yes, but the function declarations must be identical.


Question 2.

Is it true that a global variable may have several declarations, but only one definition?


  1.    Yes
  2.    No
 Discuss Question
Answer: Option A. -> Yes

Yes, In all the global variable declarations, you need to use the keyword extern.


Question 3.

Global variable are available to all functions. Does there exist a mechanism by way of which

it available to some and not to others.


  1.    Yes
  2.    No
 Discuss Question
Answer: Option B. -> No

The only way this can be achieved is to define the variable locally in main() instead of 

defining it globally and then passing it to the functions which need it.



Question 4.

Suppose a program is divided into three files f1, f2 and f3, and a variable is defined in the file 

f1 but used in files f2 and f3. In such a case would we need the extern declaration for the 

variables in the files f2 and f3?


  1.    Yes
  2.    No
 Discuss Question
Answer: Option A. -> Yes

No answer description available for this question. 


Question 5.

Is there any difference in the following declarations?

int myfun(int arr[]);
int myfun(arr[20]);



  1.    Yes
  2.    No
 Discuss Question
Answer: Option A. -> Yes

Yes, we have to specify the data type of the parameter when declaring a function.


Question 6.

Range of float id -2.25e+308 to 2.25e+308


  1.    True
  2.    False
 Discuss Question
Answer: Option B. -> False

False, The range of float is -3.4e+38 to 3.4e+38.


Question 7.

Range of double is -1.7e-38 to 1.7e+38 (in 16 bit platform - Turbo C under DOS)


  1.    True
  2.    False
 Discuss Question
Answer: Option B. -> False

False, The range of double is -1.7e+308 to 1.7e+308.


Question 8.

If the definition of the external variable occurs in the source file before its use in a particular 

function, then there is no need for an extern declaration in the function.


  1.    True
  2.    False
 Discuss Question
Answer: Option A. -> True

True, When a function is declared inside the source file, that function(local function) 

get a priority than the extern function. So there is no need to declare a function as 

extern inside the same source file.


Question 9.

Size of short integer and long integer would vary from one platform to another.


  1.    True
  2.    False
 Discuss Question
Answer: Option A. -> True

True, Depending on the operating system/compiler/system architecture you are working on, 

the range of data types can vary.


Question 10.

Size of short integer and long integer can be verified using the sizeof() operator.

True


  1.    True
  2.    False
 Discuss Question
Answer: Option A. -> True


True, we can find the size of short integer and long integer using the sizeof()
operator.
Example:


#include<stdio.h>
int main()
{
short int i = 10;
long int j = 10;
printf("short int is %d bytes., nlog int is %d bytes.",
sizeof (i), sizeof(j));
return 0;
}
Output:
short int is 2 bytes.
long int is 4 bytes.


Latest Videos

Latest Test Papers