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

C++ Questions! A few questions i need answered: 1. Can every for loop be impleme

ID: 3830411 • Letter: C

Question

C++ Questions!

A few questions i need answered:

1. Can every for loop be implemented as a while loop? why or why not?

2. Can every if statement be implemented as a switch statement?

3. Explain the process in which C++ code becomes a running executable

4. Which of the following pairs is considered proper function overloading? Why are the other 2 improper?

void f(int i); void f(int i); void f(int i);

void f(int j); void f(double i); double f(int i);

5. What does "reducing the problem" mean in regards to solving a computing problem? Give an example.

6. if A is an int value, whats the difference between a++ and ++a?

7. typically, when you have an array variable you also have a corresponding counter that indicates how many values are in the array. Suppose you have to maintain a collection of golf scores when the collection could, at any moment, have between 0 and 18 values in it. Describe a scheme to be able to determine the number of entries in the array without having to maintain a counter?

8. Explain how a variable of type int** is like a two dimensional array of int values.

9. Explain how bubble sort and select sort algorithms differ.

Explanation / Answer

1)Yes we can, just by setting up a similar exit condition. And also code will function the same in both cases, if the code is valid.


3) In c++ the code becomes a running executableParsing source code as following stages:

Parsing source code:
In this stage the code is break up into smaller parts. This is the first stage before source code converted into meaningful data .After this step source code is ready for compilation.

Compiling source code
While source code is compiled, it is turned into machine code through a series of steps.

Interpreting source code
In this stage turning it into an intermediate form which is executed by a program called an interpreter. Interpreter interprets the source code into compouter understanding language.


4) void f(int i);   
void f(double i);;   

The above two are considered proper function overloading. Because to overload we need same data type for functions. And for oparators we need different. Then only overloading works.

6)++a will increment the value of a, and then return the incremented value. Let us consider the below example code.
a = 1;
b = ++a;
(a is 2, b is 2)
a++ will increment the value of a, but return the original value that a held before being incremented.
a = 1;
b = a++;
(a is 2, b is 1)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote