Tuesday, July 17, 2018

CEIS 420 CEIS420 Week 4 Homework Solution

CEIS 420 CEIS420 Week 4 Homework Solution



BUY HERE

CEIS 420 Week 4 Homework Answer (DeVry)
Question 1 (5 points)
Rewrite the following code segment using multiple-selection statement in C++, Java, or C#.  
if  ((  k ==  1 )  ||  ( k == 2 ))   j  =  2  *  k  –  1
if  ((  k ==  3 )  ||  ( k == 5 ))   j  =  3  *  k  +  1
if  ((  k ==  4 )  j  =  4 * k – 1 
if  (( k  ==  6 )  ||  ( k == 7 ) || ( k == 8 ))  j  =  k – 2 
Question 3 (10 points)
Consider the following program written in C syntax.

void swap (int a, int b) {
 int temp;
 temp = a;
 a = b;
 b = temp;
}
void main ( ) {
 int value = 2, list[5] = {1, 3, 5, 7, 9};
 swap (value, list[0]);

}

For both of the following parameter-passing methods, what is the value of the first element of list after both of the following? 
a) Pass-by-value for list[0]
b) Pass-by-reference for list[0]


No comments:

Post a Comment