1 A function prototype must always be placed before the main function whenever a value returning function and void function is defined after the main function
2 Defined variables are known as arguments or actual values in a function definition and parameter list in the calling function.
3 It is not mandatory for a function procedure to always have a return statement in C++
4 A post-test loop will execute the statements inside the loop atleast once before the condition is tested.
5 A for loop cannot be used inside a pre-test loop
True or false statemets
1A function call can be in a if-statement, display statement or assignment statement
2 A function procedure is said to be value returning and a sub procedure is a void function that does not return a value at the end of the execution.
3 double CalcPercentage(double, double); is an example of a function prototype
4 A reference parameter is the address of the variable in the computer’s memory
5 A void function can have value and reference parameters
HeapSort an array with constant space complexity O(1).
What is heap. Create maximum heap using built in function or using array list. Use any one method for creation max heap.
Implementation the following function using Binary Search trees
I. Create BST.
II. Deletion of BST.
III. Searching maximum and minimum value in BST.
Write the algorithm and pseudocode for finding the average of five(5) numbers.
Calculate the time complexity of the following program fragments.
(a) 𝑓𝑜𝑟 (𝑖 = 1; 𝑖 ≤ 𝑛; 𝑖 ∗ = 2)
{ 𝑥=𝑥+1 }
(b) 𝑓𝑜𝑟 (𝑖 = 1; 𝑖 ≤ 𝑛; 𝑖 + +)
𝑓𝑜𝑟 (𝑗 = 1; 𝑗 ≤ 𝑛; 𝑗 = 𝑗 ∗ 2) {
....
....
}
] Write the algorithm of a program that reads the input line-by-line and count the number of lines. Program should terminate when end-of-file (EOF) is reached
Write the algorithm of a program that reads password from the user and then compare it with the original password stored in file. If the password matches, it should display you got 10 marks else it should print you have failed.