3) Given the declarations below, answer the questions that follow: I/ Assume MAXVAL is a valid declared constant char arrayNames[MAXVAL][25]: int arrayValues[MAXVAL]; / Assume all values in arrayValues are positive int sum - 0; int max - 0; int cntr: II Assume that valid values are put into arrayValues and I/ Assume valid names are put into arrayNames Question 3 3.a) Write a definite loop header that would increment the existing variable called cntr from 0 through MAXVAL-1 inclusive. Leave out any unneeded blanks. Do NOT include the curly brace for the beginning of the loop body. int cntr Question 4 3.b) Assume that your loop header works correctly. Write one C statement that would be inside the loop body and would sum the up values from arrayValues into the variable called sum. Leave out any unneeded blanks and do not include the curly braces for the loop body. Question 5 3.c) Still in the loop body, write a test condition that would test to see if the current element is bigger than the current maximum value, max. The test should be true if the current element is bigger than max. The test condition would go in the parentheses of an if statement such as shown below. Leave out any unneeded blanks. Ex. if ( Write your test condition below. Remember to leave off the outside parentheses. Question 6 3.d) Still in the loop body and now inside the if statement from the previous question, write an assignment statement that will keep track value of the largest element found so far. This statement will only run if the test condition in the if is true. Leave out any unneeded blanks, Question 7 3.e) Assume you are still inside the same loop as above. After the if statement, which of the following C tatements would print the following message for each value in array. Choose the C statement that would print the message below for each array value. For Name, row N, the value is Value. where N is the current row in the arrays Name is the element at row N in the names array, i.e. arrayNamesjat row NJ, and Value is arrayValues[at row N] O printf("For %s, row %d, the value is %d. \n", arrayValues[cntr), cntr, arrayNames(cntr): O printf("For %s, row %d, the value is %d.\n", arrayNames[N], N, arrayValues[N]): O printf("For %s, row %d, the value is %d.\n", arrayNames[cntr), cntr, arrayValues[cntr): O printf("For %s, row %d, the value is %d.\n", arrayNames(cntr), arrayValues[cntr), cntr):
3) Given the declarations below, answer the questions that follow: I/ Assume MAXVAL is a valid declared constant char arrayNames[MAXVAL][25]: int arrayValues[MAXVAL]; / Assume all values in arrayValues are positive int sum - 0; int max - 0; int cntr: II Assume that valid values are put into arrayValues and I/ Assume valid names are put into arrayNames Question 3 3.a) Write a definite loop header that would increment the existing variable called cntr from 0 through MAXVAL-1 inclusive. Leave out any unneeded blanks. Do NOT include the curly brace for the beginning of the loop body. int cntr Question 4 3.b) Assume that your loop header works correctly. Write one C statement that would be inside the loop body and would sum the up values from arrayValues into the variable called sum. Leave out any unneeded blanks and do not include the curly braces for the loop body. Question 5 3.c) Still in the loop body, write a test condition that would test to see if the current element is bigger than the current maximum value, max. The test should be true if the current element is bigger than max. The test condition would go in the parentheses of an if statement such as shown below. Leave out any unneeded blanks. Ex. if ( Write your test condition below. Remember to leave off the outside parentheses. Question 6 3.d) Still in the loop body and now inside the if statement from the previous question, write an assignment statement that will keep track value of the largest element found so far. This statement will only run if the test condition in the if is true. Leave out any unneeded blanks, Question 7 3.e) Assume you are still inside the same loop as above. After the if statement, which of the following C tatements would print the following message for each value in array. Choose the C statement that would print the message below for each array value. For Name, row N, the value is Value. where N is the current row in the arrays Name is the element at row N in the names array, i.e. arrayNamesjat row NJ, and Value is arrayValues[at row N] O printf("For %s, row %d, the value is %d. \n", arrayValues[cntr), cntr, arrayNames(cntr): O printf("For %s, row %d, the value is %d.\n", arrayNames[N], N, arrayValues[N]): O printf("For %s, row %d, the value is %d.\n", arrayNames[cntr), cntr, arrayValues[cntr): O printf("For %s, row %d, the value is %d.\n", arrayNames(cntr), arrayValues[cntr), cntr):
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Please don't copy the answer
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY