ENGIN 7 Study Guide - Midterm Guide: Floating Point, C String Handling, Quicksort

29 views10 pages
8 Jan 2019
School
Department
Course
Professor

Document Summary

Uc berkeley honor code: as a member of the uc berkeley community, i act with honesty, integrity, and respect for others. On my honor, i have neither given nor received any assistance in the taking of this exam. There is one correct answer for each question. Spring 2016: when executing the following piece of code, which line will generate an error? a = [2 3 4]; % line 1. % line 2 c = d + b. /a; % line 3 d = 0. 5*c; % line 4 (a) line 1 (b) line 2 (c) line 3 (d) line 4 (e) matlab will not return an error. Consider this function for the next two questions: function [output] = mystructarray(input) n = length(input)/2; for i = 1:n output(i). name = input{i}; output(i). instrument = input{i+n}; end end. Then the following is typed into the command window: