Electrical Engineering > EXAM > University of WaterlooECE 150FIinalExam-Fall2016 - Solution-vF17 (All)
Question 1: True or False [21 Marks] Record your answer on the Scantron card as follows: Fill in the A circle for TRUE Fill in the E circle for FALSE If you fill in more than one circle it will be ... deemed to be incorrect. +3 marks for each correct answer, 0 marks for each instance of no response, –1 mark for each incorrect answer SCANTRON Question 1: Given the following two functions: int arraySum1(int num, int* pArray) { int i = 0; int sum = 0; while (i < num) { sum += *(pArray+i); i += 1; } return sum; } int arraySum2(int num, int array[]) { int sum = 0; for (int i = num; i > 0; --i) sum = array[i-1] + sum; return sum; } arraySum1() and arraySum2() will produce the same return value if given the same input values. Answer: TRUE SCANTRON Question 2: The following code: #include <iostream> using namespace std; void strSet(char* target, const char* source) { while(*source) *target++ = *source++; } int main() { char A[100]="Freddy Mercury"; char B[100]="Martha"; strSet(A, B); cout << A << endl; return 0; } will output “Martha” to the console [Show More]
Last updated: 3 years ago
Preview 1 out of 17 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
May 16, 2021
Number of pages
17
Written in
All
This document has been written for:
Uploaded
May 16, 2021
Downloads
0
Views
66
Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·