Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.What is a function? 2.A function prototype tells the compiler four things. Wha

ID: 3622165 • Letter: 1

Question

1.What is a function?



2.A function prototype tells the compiler four things. What are they?




3.There are three methods data is passed to functions, what are they?




4. Name three types of control structures.




5. Why is it important to initialize variables in a program?






6. Give an example of an event controlled loop.










Defining an identifier as const does what?








Why is the following condition good practice? if( 5 == num)










Explain short circuit logic using || (OR).










Compare contrast static and automatic storage class (lifetime).










Explain what the ‘&’ ampersand allows regarding functions.










Define scope.










Compare contrast post and pre increment unary operators.










Define an array.










C++ has no bounds checking. What does this mean?






What is the difference between a while and a do/while loop?










Write a declaration statement for a file named infile.






Write a for loop that creates the following.
+++++

++++

+++

++

+





Explanation / Answer

1. A function is a collection of statements that performs a specific task. Ex: We have created a function named main() in every programming language, and we have used library functions such as pow() and strcmp(). 2. Names of control structures. 1. Conditional structure: if and else 2. Iteration structures: loops 3. Selective structure: switch. 3.Why is it important to initialize variables in a program? Because the variables represent storage locations in the computer memory. 4.Array : an array allows you to store and work with multiple values of the same data type. 5. Difference between a while and a do/while loop? The while and the do-while are used to execute a block of code as long as condition is true.But in the while loop tests its condition before execution of the contents of the loop begins but the in the do-while loop tests its condition after it executed at least once.