1. What is a loop/Iteration?

  • A loop/Iteration is a set of lines executed repeatedly.
  • A loop essentially consists a condition.
  • A loop runs till the condition is true, stops when it becomes false

Example:

  • while - entry check loop
  • Do…while - exit check loop
  • for loop

2. What are functions? (or) Define Functions.

  • Functions are the building blocks of c++ programs.
  • Functions means writing a part of a program separately under a different name.
  • The main purpose of writing functions is reusability of code
  • Functions always end with paranthesis, i.e, ()
  • Functions has to be
  • Declared
  • Defined and
  • Invoked

3. What are the advantages of functions?

  • Increases Modularity.
  • Reusability of code.
  • Easy to test & Debug.
  • Transferable across programs.

4. Describe about call by value & call by reference?

  • Call by reference when parameters are passed to a function it is passed either as call by value or as call by reference.
  • In call by value the actual parameters are copied to formal parameter,
  • So changes in the called function will not be seen in calling function.
  • In call by reference an alias name is given to actual parameters ,so
  • Changes in called function seen in calling function.

We must add & (amperesand) before formal parameters in call-by-reference.


Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments