CMSC 140- FINAL EXAM QUESTIONS WITH 100% CORRECT ANSWERS | GRADED A+
CMSC 140- FINAL EXAM QUESTIONS WITH 100% CORRECT ANSWERS | GRADED A+ QUESTION 1: The last legal subscript that can be used with the array intlist declared below (see array declaration below) is [×1) Avray declaration: intlist [10] - answer-9 QUESTION 2: Indicate If the following condition is True or False Assume the variables x=5 y=6 and z=8 7 =(x+y) && z 4 - answer-True QUESTION 3: Choose the best answer to fill in the blank in the statement below. A (An) BLANK function is a function that doesn't return a value. - answer-Void QUESTION 4: Indicate if the following expression is True or False Assume the variables int a=3, b=4, c=6, 4!=b || c! = (a+3) - answer-True QUESTION 5Using a looping structure, prompt uner for positive integer values from the keyboard. Ignore all negative values and terminate the loop once a value that is greater than 10 is entered. After the loop ends , print the total of the read integers Enter an integer 4 Enter an integer 8 Enter an integer 0 [Console] invalid please try again Enter an integer 10 Enter an integer: 11 Total: 22 - answer-#include iostream using namespace std; int main() { int total = 0, num; while (true) { cout "Enter an integer: "; cin num; if (num 0) cout "Invalid input. Please try again." endl; else if (num 10) break; else total += num; }cout "Total: " total endl; return 0; } QUESTION 6: ind cato it tho lotowina expression is True or Falsel Assume the variables int a = - 3, b = 6, c = 6, a=-1 || c = (b+a/2), - answer-True QUESTION 7: Which of the following is a correct statement about for loop (select two) - answerQUESTION 8 Vinte a function prototype and a function definition called average that receives an array of type integer, and the number of elements in the arra) It returns the average of the numbers in the array - answer-double average(int arr[ ], int size); double average(int arr[ ], int size) { int sum = 0; for (int i = 0; i size; ++i) { sum += arr[i]; }return static_castdouble(sum) / size; } QUESTION 9: Evaliate the following expression (25.0/2* (8/3)) -1 [x1] - answer-24 QUESTION 10: REDO Evaluating Output 2 De be of on be alone code see elito los, please kenty aed oglin. 1 poine - answerQUESTION 11: Rewrite the following conditional expressions as if else statements cout((num%5)==0)? " jackpot !!" "Sorry !!n"; - answer-if ((num % 5) == 0) { cout "jackpot !!" endl; } else { cout "Sorry !!" endl;
Written for
- Institution
- CMSC 140
- Course
- CMSC 140
Document information
- Uploaded on
- February 5, 2026
- Number of pages
- 10
- Written in
- 2025/2026
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
cmsc 140 final exam questions with 100 correct a