Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello~~ I would like to know the correct answer! Please help me^.^ QUESTION 1 Consider this C program: #include void addOne (int* incoming) { *incoming

Hello~~

I would like to know the correct answer! Please help me^.^

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
QUESTION 1 Consider this C program: #include void addOne (int* incoming) { *incoming += 1; return; int main (void) int argl = 4; addOne (&arg1) ; printf ("The value stored in argl is $d\ ", argl) ; return 0 ; Select from the following all correct answers. When the function addOne() finishes execution the statement return; is required to return control to main() When the function addOne() runes, the pointer variable incoming stores a copy of the value stored in arg1 O *in += 1; Adds one to the value stored at the address stored in arg1 O printf ("The value stored in argl is id\ ", argl) ; //outputs "The value stored in arg1 is 5" O addOne (&argl) ; When this function call executes the address of arg1 is stored inside the pointer named incoming.QUESTION 2 Select all of the following statements that are true about function coupling. The less information that passes between the module and the other modules the better the design. It is preferable that each module complete it's own calculations and does not pass control to another module. O Coupling describes the degree of interrelatedness of a module with other modules. O A module that receives a value and returns the tax owing on that value using a sliding scale is highly coupled. O A module that receives 2 dates and returns the number of days between the dates is highly coupled. QUESTION 3 Consider the following code: #include int addThese(int arg1, int arg2) return arg1 + arg2; int main(void) int sum1 = 2, sum2 = 3, answer = 0; answer = addThese(sum1, sum2); printf("%d\ ", answer); return 0; Select all of the following statements which are true. O arg1 and arg2 are arguments O arg1 and arg2 are parameters O sum1 and sum2 are parameters sum1 and sum2 are argumentsSelect all the answers that apply to modular design: 1. A module may not refer to other modules. 2. Modular design identifies the components of a program that can be developed independently. 3. Modular design is an important part of procedural programming. O 4. Each module consists of a set of logical constructs that are related to one another. QUESTION 5 Consider the following code: #include void addTwo(int* param1, int* param2) *param1 -= 2; param2 += 3; return; int main(void) int arg1 = 5, arg2 = 7; addTwo(&arg1, &arg2); printf("arg1 = %d and arg2 = %din", arg1, arg2); return 0; Select all of the following answers which are true: 1. addTwo(&arg1, &arg2); /outputs "arg1 = 10 and arg2 = 3" O 2. This call would cause a run time error: addTwo(arg1, arg2); 0 3. addTwo(&arg1, &arg2); //outputs "arg1 = 3 and arg2 = 10" O 4. The ability to pass pointers to functions allows us to code functions that can change 2 or more variables when the function is executed.QUESTION 6 Order the following statements so they represent the correct order of operation of the following program: #include int main(void) printf( "Hello world!\ "); return 0; the printf function outputs "Hello world!" followed by a new line main() returns control to the OS, with value zero(0) printf() returns control to main() main() transfers control to printf() QUESTION 7 The following tasks could be performed in one cohesive module: . receive a floating point value calculate the GST (VAT) owing on the value received . total the received value and the tax . return the total O True O FalseQUESTION 3 A function that does not receive any data when called has no parameters and must use the term void in the parameter list. 0 True 0 False QUESTION 9 The following tasks could be performed in one cohesive module: . receives a date . calculates the fuel required to drive from Toronto to Montreal . returns the square root of an imaginary number 0 True 0 False QUESTION 10 A pointer variable is not strongly typed, which means that the address of a oating point variable may be stored in an int type pointer. 0 True 0 False QUESTION 11 Consider this code snippet: int x = 0; int *p = 8):; *p = 73557; After this code snippet runs the address of x is set to T9567. 0 True 0 False QUESTION 12 We can access the data in a variable through either the variable name or by dereferencing its address. 0 True 0 False QUESTION 13 Every.r variable in a C program has a unique address. 0 True 0 False QUESTION 14 A function that does not return anything must declare the return type as void and is not required to have a return statement, however it is considered a best practice to include "return;" as the last line anyway. O True O False QUESTION 15 Place the following parts of a function header into their correct order: closing parenthesis return type type parameters opening parenthesis identifier

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions