C Programming: Declarations and Initializations – True / False Questions

0
649
C Programming: Declarations and Initializations - True / False Questions
C Programming: Declarations and Initializations - True / False Questions

C Programming: Declarations and Initializations – True / False Questions

  • General Questions – Declarations and Initializations 
  • Find Output of Program – Declarations and Initializations
  • Point Out Errors – Declarations and Initializations
  • Point Out Correct Statements – Declarations and Initializations
  • True / False Questions – Declarations and Initializations
  • Yes / No Questions – Declarations and Initializations

1. Is there any difference in the following declarations?
int myfun(int arr[]);
int myfun(arr[20]);

A. Yes
B. No

Answer: Option A Explanation: Yes, we have to specify the data type of the parameter when declaring a function.

 

2. 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?

A. Yes
B. No

Answer: Option A Explanation: No answer description available for this question.

 

3. Global variables are available to all functions. Does there exist a mechanism by way of which is available to some and not to others?

A. Yes
B. No

Answer: Option B Explanation: 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. 

 

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

A. Yes
B. No

Answer: Option A Explanation: Yes, In all the global variable declarations, you need to use the keyword extern. 

 

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

A. Yes
B. No

Answer: Option A Explanation: Yes, but the function declarations must be identical. 

 

TAGS: C Programming: Declarations and Initializations » Find Output of Program, C Programming, Declarations, and Initializations, Find Output of Program, c programming basics, c programming language, c programming patterns, c programming tutorial, c programming example, c programming pdf, for c programming example, c programming questions, c programming questions, and answer

 

www.GKDuniya.in will update many more new jobs and study materials and exam updates, keep Visiting and share our post of Gkduniya.in, So more people will get this. This content and notes are not related to www.GKDuniya.in and if you have any objection over this post, content, links, and notes, you can mail us at gkduniyacomplaintbox@gmail.com

And you can follow and subscribe to other social platforms. All social site links in the subscribe tab and bottom of the page.

Important Links

Youtube:- GKDuniya9
Instagram:- GKDuniya.in
Facebook:– GKDuniya.in