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

1) Indicate which one of the following is the function prototype, the function c

ID: 3631289 • Letter: 1

Question

1) Indicate which one of the following is the function prototype, the function call, and the function header:

shownum(double num)

int shownum(double);

shownum(45.67);

2) What is the output of the following program:

#include <iostream.h>
#include <iostream.h>
#include <conio.h>

int x=5;

void func1(int);
void func2(int &);
int func3(int);

void main ()
{
int x=1;

cout <<" 1 :"<< x;
cout << " 2 :"<<::x;

{
int x=6;

cout <<x;
}

func1(x);
cout <<" 3 :"<< x;

func2(x);
cout << " 4 :"<<x;

func3(x);
cout << " 5 :"<<x;

func1(x);
cout << " 6 :"<<x;
}

void func1(int x1)
{
static int x=2;

cout << " 7 :"<<x++;
}

void func2(int &x)
{
cout <<" 8 :"<< x++;
}

int func3(int x)
{
return(x++);
}


3) write the prototype and header for a function called calculate. The function should have three parameters. int, a reference float and an int parameter. The function should return a float

4) write overloaded functions that calculates the sum of two numbers which would be passed into the function. one function accepts integers, the other function accepts floats

5) what are the errors

a) float inline average(int value1, value2)
{
float average;

average=value*2;
}

b) void area(int length, int width);
{
int length;
return length *width;
}

c) void getvalue(int value&)
{
cin >> value&
}

d) overloaded functions

int getvalue(int x)
{
return(x++);
}

float getvalue(int x)
{
return(x++);
}

e) void show_num(int x)
{
void show float(float y)
{
cout << y;
}
cout << x;
}

6) Declare the following array

a) empnum, a 98 element array of ints

b) landscape, a 5 element array of trees

c) declare a two dimensional array of ints named grades. It should have 30 rows and 10 columns

7) What is wrong

a) int readings[-1];

b) float measurement[4.5]

c) int size;
char name[size];

d) int numbers[4]=[1,3,5,6];

e) int matrix[5]={0,1,2,3,4,5};

f) int table[6]={2,,,27,45};

g) float array1[4]={1,2,3,4};
float array2[];

array1=array2;

h) char [5]=”hello”;

i) define sum 0;

j) float table2[];

k) int k[1,2];

l) const int h;
h=5;

8) Given the following array declaration

int values[6]={2,6,1,14}

what do each of the following display?

a) cout << values[2];

b) cout << ++ values[0];

c) cout << values[1]++;

d) x=2; cout<< values [++x];

e) cout << values[5];

f) cout << values[6];

g) cout << ++values[values[values[0]]];

h) static variable[4];
cout << variable[1];


9) a) When an array name is passed to a function, what is actually being passed
b) Can an array be returned
c) How do you pass an array by value
d) Pass by reference but do not allow the array to be changed inside the function

10) How many elements are in the following array. How many bytes are allocated for this
array.
int arr[11][3];

11) Declare an array named setting large enough to hold the information in the table below. Initialize the array with the information listed in the table

2 3
4 0
0 0


a) write a statement that displays the contents of the last column of 2nd row
b) write a statement that sets the 2nd column of the first row to 99.97

12)Fill in the table so that it shows thecontents of the following array
int table[3][4]={{2,3},{7,9,2},{3}};

13) Write a function called display array. The function should accept a two dimensional array as one of the arguments and display its contents.

14) Declare a three dimensional array that represents a video storage system. the store has 50 racks each having ten shelves, each shelf holding 25 videos. Use #defines

15) Describe the difference between a bubble sort and selection sort

16) define an enum that contains the following items: Phone, Desk, Chair, Wall where
the phone is 5, desk is 6 chair is 8 and wall is 9 and then define a variable of that enum
type.

Explanation / Answer

CRAMSTER rule- 1 question per post--I will do a few

please rate- thanks