ECE 15 Fall 15 Midterm Solutions
|
|
- Steven Malone
- 6 years ago
- Views:
Transcription
1 ECE 15 Fall 15 Midterm Solutions This is a closed-book exam: no notes, books, calculators, cellphones, or friends are allowed. In problems 2 4, you can assume that the uers s input is correct. If you need more space, please use the back of the page. You have 80 minutes. Good luck! Name: PID: A Points 1. /40 2. /20 3. /20 4. /20 = /100
2 Problem 1 (40 points) For each of the following programs, indicate whether or not it has errors. If there are errors, mark all of them (there may be more than one) on the program and briefly describe the problems. If there are no errors, write the program s output. Hint: two programs contain errors. (1) #include <stdio.h> int a = 2; printf("%d=2 is %s", a, a == 2? "T" : "F"); X No Output: 2 = 2 i s T (2) #include <stdio.h> #define a printf("%.5f", 10+a); X No Output: (3) #include <stdio.h> int x = 2; int y = 1; int z; z = (x<y)? 1 : 0; if(z) printf ("%d", ++x+y); else printf ("%d", ++y-x); X No Output: 0 (4) #include <stdio.h> int a = 3; int b = 2; double z = 2.3; char c = A - a + b ; int v, r; v = a > z > b; r = (c == B ) && ((int)z == 2); printf("v=%d,r=%d", v, r); X No Output: v = 0, r = 1
3 (5) #include <stdio.h> double number = 10.5; i = 1; while (i < 5) { number *= 2; printf("%d,",number); i++; No Output: X (6) #include <stdio.h> int value = 0 ; for (int i = 0; i<5; i++) { value += i % 2; printf("%d", value); X No Output: 2 (7) #include <stdio.h> char c = A ; int rem; for (int i = 0; i<7; ++i) { rem = i % 3; switch(rem) { case 0: printf("%c", c+1); break; case 1: printf("%c", c+2); break; default: printf("%c", c); X No Output: B C A B C A B (8) #include<stdio.h> int i = -1, j = 1, k = 0, m, n; m = ++i j--; n = j-- && ++k; printf("%d,%d", m, n); X No Output: 1, 0
4 (9) #include <stdio.h> int limit = 50; for (int i = 0; i <= limit; i+=5) { if (i == 30) break; if (i % 10 == 0) continue; printf("%d ",i); X No Output: (10) #include <stdio.h> double x = 1; for (int i = 5, i> 0, i-- ) { x /= (i-3); printf("%lf", x); No Output: X
5 Problem 2 (20 points) Write a program that asks the user for 15 characters (as usual, followed by a new line), and counts the number of identical consecutive character pairs entered, namely, the number of characters followed by the same character. For example, the word bookkeeping has three identical consecutive pairs (o, k, and e), and skillless also has three pairs (two l s and s). Characters can be letters, digits, punctuation marks, spaces, etc. 15 characters: I love the food 1 15 characters: ammaaaazinggg!! 7 15 characters: Is this okay?? 2 (~)$ Describe your rough approach in a few lines: #include <stdio.h> char previous = \n ; char current; int counter = 0; printf("15 characters: "); for (int i = 0; i < 15; i++) { current = getchar(); if (current == previous) counter++; previous = current; printf("%d\n", counter);
6 Problem 3 (20 points) Write a program that asks the user for a positive integer and prints the alternating sum of its digits. The alternating sum is calculated by starting with the rightmost digit, subtracting the second rightmost digit, adding the third, etc. For example, the alternating sum of 3625 is = 6. Positive integer: 1234 Altenrating sum: 2 Positive integer: Alternating sum: -7 Positive integer: Alternating sum: 0 (~)$ Describe your rough approach in a few lines: #include <stdio.h> int number; int sum = 0; int sign = 1; printf("positive integer: "); scanf("%d", &number); do { sum += sign * (number % 10); sign *= -1; while (number /= 10); printf("alternating sum: %d\n",sum);
7 Problem 4 (20 points) We are throwing a post-midterm party and ordering 2 KFC grilled-chicken pieces per guest. Chicken pieces come in packs of 2, 6, 12, and 24, and to save for our real post-final celebration, we would like to order the largest packs possible. Write a program that takes the number of guests and outputs the number of packs of each size. Note that you first need to get the largest number of 24-packs, then the largest number of 12-packs, etc., and recall that each guest consumes two pieces. Number of guests: 1 0x24, 0x12, 0x6, 1x2 Number of guests: 14 1x24, 0x12, 0x6, 2x2 Number of guests: 22 1x24, 1x12, 1x6, 1x2 (~)$ Describe your rough approach in a few lines: #include <stdio.h> int twentyf, twelve, six, two; int guest; printf("number of guests: "); scanf("%d", &guest); int piece = 2 * guest; twentyf = piece / 24; twelve = (piece - twentyf * 24) / 12; six = (piece - twentyf * 24 - twelve *12) / 6; two = (piece - twentyf * 24 - twelve *12 - six * 6) / 2; printf("%dx24, %dx12, %dx6, %dx2\n", twentyf, twelve, six, two);
ECE 15 Fall 15 Final Solutions
ECE 15 Fall 15 Final Solutions This is a closed-book exam: no notes, books, calculators, cellphones, or friends are allowed. In problems 2 7, you can assume that the user s input is correct. User input
More informationECE 15 Fall 16 Midterm Solutions
ECE 15 Fall 16 Midterm Solutions This is a closed-book exam: no notes, books, calculators, cellphones, or friends are allowed. In problems 4 6, you can assume that the user s input is correct. If you need
More informationUniversity of California San Diego Department of Electrical and Computer Engineering. ECE 15 Midterm Exam
University of California San Diego Department of Electrical and Computer Engineering ECE 15 Midterm Exam Tuesday, February 17, 2015 12:30 p.m. 1:50 p.m. Room 109, Pepper Canyon Hall Name Class Account:
More informationEECE.2160: ECE Application Programming Fall 2017
EECE.2160: ECE Application Programming Fall 2017 1. (46 points) C input/output; operators Exam 1 Solution a. (13 points) Show the output of the short program below exactly as it will appear on the screen.
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Midterm Examination October 20, 2011 6:15 p.m. 8:00 p.m. (105 minutes) Examiners: J. Anderson, T. Fairgrieve,
More information"'"' .;, b) F or ( c = l ; c <= 10,"' c++ ) X { JJ. ~. Computer Programming I COME Midterm Examination. Fall November 2016
Group B ~. Computer Programming I COME 103 - Midterm Examination B Fall 2016 21 November 2016 1. Identify and correct the errors in each of the following statements. (Note: There may be more than one error.)
More informationQ1: C input/output; operators / 46 Q2: Conditional statements / 34 Q3: While and do-while loops / 20 TOTAL SCORE / 100 Q4: EXTRA CREDIT / 10
EECE.2160: ECE Application Programming Fall 2017 Exam 1 October 4, 2017 Name: Lecture time (circle 1): 8-8:50 (Sec. 201) 12-12:50 (Sec. 203) 1-1:50 (Sec. 202) For this exam, you may use only one 8.5 x
More informationPDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs
PDS Lab Section 16 Autumn-2017 Tutorial 3 C Programming Constructs This flowchart shows how to find the roots of a Quadratic equation Ax 2 +Bx+C = 0 Start Input A,B,C x B 2 4AC False x If 0 True B x 2A
More informationEECE.2160: ECE Application Programming Spring 2016 Exam 1 Solution
EECE.2160: ECE Application Programming Spring 2016 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationChapter 13 Control Structures
Chapter 13 Control Structures Control Structures Conditional making a decision about which code to execute, based on evaluated expression if if-else switch Iteration executing code multiple times, ending
More informationUniversity of Maryland College Park Dept of Computer Science CMSC106 Fall 2013 Midterm I Key
University of Maryland College Park Dept of Computer Science CMSC106 Fall 2013 Midterm I Key Last Name (PRINT): First Name (PRINT): University Directory ID (e.g., umcpturtle) I pledge on my honor that
More information80 Minutes CENG 230 MidtermExam :40
80 Minutes CENG 230 MidtermExam 02.12.2014 17:40 There are 40 questions (each 2.5 points) for a total of 100 points. Exam Type: A All questions are multiple choice, no points will be lost for wrong answers.
More informationUNIVERSITY OF WINDSOR Fall 2007 QUIZ # 2 Solution. Examiner : Ritu Chaturvedi Dated :November 27th, Student Name: Student Number:
UNIVERSITY OF WINDSOR 60-106-01 Fall 2007 QUIZ # 2 Solution Examiner : Ritu Chaturvedi Dated :November 27th, 2007. Student Name: Student Number: INSTRUCTIONS (Please Read Carefully) No calculators allowed.
More informationChapter 13. Control Structures
Chapter 13 Control Structures Control Structures Conditional making a decision about which code to execute, based on evaluated expression if if-else switch Iteration executing code multiple times, ending
More information16.216: ECE Application Programming Fall 2011
16.216: ECE Application Programming Fall 2011 Exam 2 Solution 1. (24 points, 6 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationCOS 126 MIDTERM 1, FALL
COS 126 MIDTERM 1, FALL 2000 1 This test has 12 questions worth a total of 50 points. You have 120 minutes. The exam is closed book, except that you are allowed to use a one page cheatsheet. No calculators
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Midterm Examination October 20, 2011 6:15 p.m. 8:00 p.m. (105 minutes) Examiners: J. Anderson, T. Fairgrieve,
More information16.216: ECE Application Programming Fall 2013
16.216: ECE Application Programming Fall 2013 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationControl Structure: Loop
Control Structure: Loop Knowledge: Understand the various concepts of loop control structure Skill: Be able to develop a program involving loop control structure 1 Loop Structure Condition is tested first
More informationEssar Placement Paper
Essar Placement Paper Question 1 The fourth proportional to 5, 8, 15 is: A. 18 B. 24 C. 19 D. 20 Let the fourth proportional to 5, 8, 15 be x. Then, 5 : 8 : 15 : x 5x = (8 x 15) x=(8*15)/5=24 Question
More informationQ1: Multiple choice / 20 Q2: C input/output; operators / 40 Q3: Conditional statements / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10
16.216: ECE Application Programming Spring 2015 Exam 1 February 23, 2015 Name: ID #: For this exam, you may use only one 8.5 x 11 double-sided page of notes. All electronic devices (e.g., calculators,
More informationQ1: Multiple choice / 20 Q2: C input/output; operators / 40 Q3: Conditional statements / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10
EECE.2160: ECE Application Programming Spring 2016 Exam 1 February 19, 2016 Name: Section (circle 1): 201 (8-8:50, P. Li) 202 (12-12:50, M. Geiger) For this exam, you may use only one 8.5 x 11 double-sided
More informationUniversity of Maryland College Park Dept of Computer Science CMSC106 Fall 2016 Midterm I
University of Maryland College Park Dept of Computer Science CMSC106 Fall 2016 Midterm I Last Name (PRINT): First Name (PRINT): University Directory ID (e.g., umcpturtle) I pledge on my honor that I have
More informationData types, variables, constants
Data types, variables, constants Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic in C 2.6 Decision
More informationMTH 307/417/515 Final Exam Solutions
MTH 307/417/515 Final Exam Solutions 1. Write the output for the following programs. Explain the reasoning behind your answer. (a) #include int main() int n; for(n = 7; n!= 0; n--) printf("n =
More informationWelcome! COMP s1. Programming Fundamentals
Welcome! 0 COMP1511 18s1 Programming Fundamentals COMP1511 18s1 Lecture 7 1 Strings Andrew Bennett chars arrays of chars strings 2 Before we begin introduce yourself to the
More informationWelcome! COMP s1 Lecture 7. COMP s1. Before we begin. Strings. Programming Fundamentals. Overview. Andrew Bennett
Welcome! COMP1511 18s1 Programming Fundamentals 0 COMP1511 18s1 Lecture 7 Strings Andrew Bennett 1 chars arrays of chars strings Before we begin 2 Overview after this lecture,
More informationMidterm Exam. CSCI 2132: Software Development. March 4, Marks. Question 1 (10) Question 2 (10) Question 3 (10) Question 4 (10) Question 5 (5)
Banner number: Name: Midterm Exam CSCI 2132: Software Development March 4, 2019 Marks Question 1 (10) Question 2 (10) Question 3 (10) Question 4 (10) Question 5 (5) Question 6 (5) Total (50) Instructions:
More informationChapter 13 Control Structures
Chapter 13 Control Structures Highlights Sequence action_1 action_2 Conditional Iteration 13-2 Control Structures Conditional making a decision about which code to execute, based on evaluated expression
More informationThe University of Calgary. ENCM 339 Programming Fundamentals Fall 2016
The University of Calgary ENCM 339 Programming Fundamentals Fall 2016 Instructors: S. Norman, and M. Moussavi Wednesday, November 2 7:00 to 9:00 PM The First Letter of your Last Name:! Please Print your
More informationCS Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015
CS 141 - Introduction to Programming Midterm Exam #2 - Prof. Reed Fall 2015 You may take this test with you after the test, but you must turn in your answer sheet. This test has the following sections:
More informationCEN 134 Algorithms and Programming II Midterm I. April Duration: 90 minutes
CEN 134 Algorithms and Programming II Midterm I April 2011 Duration: 90 minutes 1 2 3 4 5 6 7 8 9 10 Total A Student Name: Student ID Number: Rules 1. Electronic device(phone,calculator,etc.) usage is
More informationFunctions. Arash Rafiey. September 26, 2017
September 26, 2017 are the basic building blocks of a C program. are the basic building blocks of a C program. A function can be defined as a set of instructions to perform a specific task. are the basic
More informationChapter 3: Arrays and More C Functionality
Chapter 3: Arrays and More C Functionality Objectives: (a) Describe how an array is stored in memory. (b) Define a string, and describe how strings are stored. (c) Describe the implications of reading
More informationIndian Institute of Technology Kharagpur Programming and Data Structures (CS10001) Autumn : Mid-Semester Examination
Indian Institute of Technology Kharagpur Programming and Data Structures (CS10001) Autumn 2017-18: Mid-Semester Examination Time: 2 Hours Full Marks: 60 INSTRUCTIONS 1. Answer ALL questions 2. Please write
More informationComputer Programming for Engineering Applica4ons. Intro to Programming 10/2/13 ECE 175. Limita4ons of Reference by Value. The Concept of Pointers
Computer Programming for Engineering Applica4ons ECE 175 Intro to Programming Limita4ons of Reference by Value Write a C func4on that does the following Argument: the radius of a circle r Output: circumference
More informationName Roll No. Section
Indian Institute of Technology, Kharagpur Computer Science and Engineering Department Class Test I, Autumn 2012-13 Programming & Data Structure (CS 11002) Full marks: 30 Feb 7, 2013 Time: 60 mins. Name
More informationStructured programming
Exercises 2 Version 1.0, 22 September, 2016 Table of Contents 1. Simple C program structure................................................... 1 2. C Functions..................................................................
More informationWorksheet 4 Basic Input functions and Mathematical Operators
Name: Student ID: Date: Worksheet 4 Basic Input functions and Mathematical Operators Objectives After completing this worksheet, you should be able to Use an input function in C Declare variables with
More information2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants
Data types, variables, constants Outline.1 Introduction. Text.3 Memory Concepts.4 Naming Convention of Variables.5 Arithmetic in C.6 Type Conversion Definition: Computer Program A Computer program is a
More informationEECE.2160: ECE Application Programming Fall 2017 Exam 3 December 16, 2017
EECE.2160: ECE Application Programming Fall 2017 Exam 3 December 16, 2017 Name: Lecture time (circle 1): 8-8:50 (Sec. 201) 12-12:50 (Sec. 203) 1-1:50 (Sec. 202) For this exam, you may use only one 8.5
More informationQuestion Bank (SPA SEM II)
Question Bank (SPA SEM II) 1. Storage classes in C (Refer notes Page No 52) 2. Difference between function declaration and function definition (This question is solved in the note book). But solution is
More informationEECE.2160: ECE Application Programming Fall 2016 Exam 1 Solution
EECE.2160: ECE Application Programming Fall 2016 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More information16.216: ECE Application Programming Fall 2011
16.216: ECE Application Programming Fall 2011 Exam 1 Solution 1. (24 points, 6 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationC Pointers. CS 2060 Week 6. Prof. Jonathan Ventura
CS 2060 Week 6 1 Pointer Variables 2 Pass-by-reference 3 const pointers 4 Pointer arithmetic 5 sizeof 6 Arrays of pointers 7 Next Time Pointers The pointer is one of C s most powerful and important features.
More informationFinal Exam 1 /12 2 /12 3 /10 4 /7 5 /4 6 /10 7 /8 8 /9 9 /8 10 /11 11 /8 12 /10 13 /9 14 /13 15 /10 16 /10 17 /12. Faculty of Computer Science
Faculty of Computer Science Page 1 of 21 Final Exam Term: Fall 2018 (Sep4-Dec4) Student ID Information Last name: First name: Student ID #: CS.Dal.Ca userid: Course ID: CSCI 2132 Course Title: Instructor:
More informationCS 101, Spring 2014 April 1st Exam 2 Question 1. [3 points] What output is printed by the following code?
CS 101, Spring 2014 April 1st Exam 2 Name: Question 1. [3 points] What output is printed by the following code? int arr[4] = {13, 1, 9, 18; printf("%i\n", arr[3]); Question 2. [3 points] Specify a function
More information16.216: ECE Application Programming Fall 2015 Exam 1 Solution
16.216: ECE Application Programming Fall 2015 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationProgramming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring
Programming and Data Structures Mid-Semester - s to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring 2015-16 February 15, 2016 1. Tick the correct options. (a) Consider the following
More informationESC 101N: Fundmentals of Computing ( IInd Semester) Mid Sem II Examination PM, Monday 7th March, 2011
ESC 101N: Fundmentals of Computing (2010-11-IInd Semester) Mid Sem II Examination 3.30-4.30PM, Monday 7th March, 2011 Instructions 1. Write your name, roll number and section below and also in the space
More informationFundamentals of Programming Session 8
Fundamentals of Programming Session 8 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 These slides have been created using Deitel s slides Sharif University of Technology Outlines
More informationECE264 Fall 2013 Exam 1, September 24, 2013
ECE264 Fall 2013 Exam 1, September 24, 2013 In signing this statement, I hereby certify that the work on this exam is my own and that I have not copied the work of any other student while completing it.
More informationBerner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2
Control Structures for C CS Basics 10) C Control Structures Emmanuel Benoist Fall Term 2016-17 Data Input and Output Single character In and Output Writing output data Control Statements Branching Looping
More informationSOFTWARE Ph.D. Qualifying Exam Fall 2017
(i) (4 pts.) SOFTWARE Ph.D. Qualifying Exam Fall 2017 Consider the following C program. #include #define START 2 #define LIMIT 60 #define STEP 7 #define SIZE 3 int main(void) { int i = START,
More informationUnited States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017
United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 1. Do a page check: you should have 8 pages including this cover sheet. 2. You have 50 minutes
More informationMidterm Exam 1 Solutions C Programming Dr. Beeson, Spring 2009
Midterm Exam 1 Solutions C Programming Dr. Beeson, Spring 2009 March 10, 2009 Instructions: Please write your answers on the printed exam. Do not turn in any extra pages. No interactive electronic devices
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Final Examination December 14, 2012 2:00 p.m. 4:30 p.m. (150 minutes) Examiners: J. Anderson, B. Li, M. Sadoghi,
More informationControl Structures. Chapter 13 Control Structures. Example If Statements. ! Conditional. if (condition) action;
Chapter 13 Control Structures Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University Control Structures! Conditional n making a decision
More informationCOP 3223 Introduction to Programming with C - Study Union - Fall 2017
COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................
More informationOperators And Expressions
Operators And Expressions Operators Arithmetic Operators Relational and Logical Operators Special Operators Arithmetic Operators Operator Action Subtraction, also unary minus + Addition * Multiplication
More informationEECE.2160: ECE Application Programming Spring 2018
EECE.2160: ECE Application Programming Spring 2018 1. (46 points) C input/output; operators Exam 1 Solution a. (13 points) Show the output of the short program below exactly as it will appear on the screen.
More informationThe output will be: marks all or nothing. 1 #include <stdio.h> 2 main() { 3 int i; int j; 4 int *p; int *q; 6 p = &i; 7 q = &j; 8 i = 1;
p. 2 of 9 Q1. [5 marks] The following program compiles and runs with no problems. Indicate what the output of the program is going to be (no explanation necessary). 1 #include 2 main() { 3 int
More information!"#$% &'($) *+!$ 0!'" 0+'&"$.&0-2$ 10.+3&2),&/3+, %&&/3+, C,-"!.&/+"*0.&('1 :2 %*10% *%7)/ 30'&. 0% /4%./
0!'" 0+'&"$ &0-2$ 10 +3&2),&/3+, #include int main() int i, sum, value; sum = 0; printf("enter ten numbers:\n"); for( i = 0; i < 10; i++ ) scanf("%d", &value); sum = sum + value; printf("their
More informationLab Exam 1 D [1 mark] Give an example of a sample input which would make the function
CMPT 127 Spring 2019 Grade: / 20 First name: Last name: Student Number: Lab Exam 1 D400 1. [1 mark] Give an example of a sample input which would make the function scanf( "%f", &f ) return -1? Answer:
More informationC Language Part 2 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 2 (Minor modifications by the instructor) 1 Scope Rules A variable declared inside a function is a local variable Each local variable in a function comes into existence when the function
More informationME 172. Sourav Saha. Md. Mahamudul Hossain Kazi Fazle Rabbi Saddam Hossain Joy Kamruzzaman Lecturer,Dept. of ME,BUET
ME 172 Introduction to C Programming Language Sourav Saha Md. Mahamudul Hossain Kazi Fazle Rabbi Saddam Hossain Joy Kamruzzaman Lecturer,Dept. of ME,BUET Courtesy: Dr. Noor Al-Quddus Cyrus Ashok Arupratan
More informationMIDTERM TEST EESC 2031 Software Tools June 13, Last Name: First Name: Student ID: EECS user name: TIME LIMIT: 110 minutes
MIDTERM TEST EESC 2031 Software Tools June 13, 2017 Last Name: First Name: Student ID: EECS user name: TIME LIMIT: 110 minutes This is a closed-book test. No books and notes are allowed. Extra space for
More informationEE 312 Fall 2018 Midterm 1 Version A October 10, 2018
EE 312 Fall 2018 Midterm 1 Version A October 10, 2018 I promise that all work on this exam is my own, that I have not received assistance on it, and that I am adhering to the University's honor code. Name:
More informationMore examples for Control statements
More examples for Control statements C language possesses such decision making capabilities and supports the following statements known as control or decision-making statements. 1. if statement 2. switch
More informationC Multiple Choice Questions and answers MCQ with Ans.
C Multiple Choice Questions and answers MCQ with Ans. 1. Who is father of C Language? A. Bjarne Stroustrup B. Dennis Ritchie C. James A. Gosling D. Dr. E.F. Codd Answer : B 2. C Language developed at?
More informationUIC. C Programming Primer. Bharathidasan University
C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions
More informationPDS: CS Computer Sc & Engg: IIT Kharagpur 1. for Statement
PDS: CS 11002 Computer Sc & Engg: IIT Kharagpur 1 for Statement Another iterative construct in C language is the for-statement (loop). The structure or the syntax of this statement is, for (exp 1 ; exp
More informationComputer Systems Programming. Practice Midterm. Name:
Computer Systems Programming Practice Midterm Name: 1. (4 pts) (K&R Ch 1-4) What is the output of the following C code? main() { int i = 6; int j = -35; printf( %d %d\n,i++, ++j); i = i >
More informationEECE.2160: ECE Application Programming Fall 2017
EECE.2160: ECE Application Programming Fall 2017 1. (34 points) Structures Exam 3 Solution a. (14 points) Show the output of the short program below exactly as it will appear on the screen. Be sure to
More informationGoals of this Lecture
C Pointers Goals of this Lecture Help you learn about: Pointers and application Pointer variables Operators & relation to arrays 2 Pointer Variables The first step in understanding pointers is visualizing
More informationProblem Solving in C. Stepwise Refinement. ...but can stop refining at a higher level of abstraction. Same basic constructs. as covered in Chapter 6
Problem Solving in C Stepwise Refinement as covered in Chapter 6...but can stop refining at a higher level of abstraction. Same basic constructs Sequential -- C statements Conditional -- if-else, switch
More informationUNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING
UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING APS 105 Computer Fundamentals Final Examination December 15, 2014 9:30 a.m. 12:00 p.m. (150 minutes) Examiners: B. Li, J. Rose, H. Timorabadi,
More informationP.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES EVEN SEMESTER FEB 2017
P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) EVEN SEMESTER FEB 07 FACULTY: Dr.J Surya Prasad/Ms. Saritha/Mr.
More informationFundamental of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi CE 43 - Fall 97 Lecture 4 Input and Output Department of Computer Engineering Outline printf
More informationECE264 Fall 2013 Exam 3, November 20, 2013
ECE264 Fall 2013 Exam 3, November 20, 2013 In signing this statement, I hereby certify that the work on this exam is my own and that I have not copied the work of any other student while completing it.
More informationH192 Midterm 1 Review. Tom Zajdel
H192 Midterm 1 Review Tom Zajdel Declaring variables Need to specify a type when declaring a variable. Can declare multiple variables in one line. int x, y, z; float a, b, c; Can also initialize in same
More informationENEE150 Final Exam Review
ENEE150 Final Exam Review Topics: Pointers -- pointer definitions & initialization -- call-by-reference and Call-by-value -- pointer with arrays -- NULL pointer, void pointer, and pointer to pointer Strings
More informationUnit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION
INTRODUCTION Decision Making and Looping Unit 5 In the previous lessons we have learned about the programming structure, decision making procedure, how to write statements, as well as different types of
More informationChapter 2. Section 2.5 while Loop. CS 50 Hathairat Rattanasook
Chapter 2 Section 2.5 while Loop CS 50 Hathairat Rattanasook Loop Iteration means executing a code segment more than once. A loop is an iterative construct. It executes a statement 0..n times while a condition
More informationECE495k Final Sample Soln.
Final Sample Soln. ECE495k ECE495k Final Sample Soln. May 3 2008 NAME: There are?? pages (including this one) in this exam. Assessment: This exam is worth a total of 100 points. There are a total of??
More informationFundamental of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 9 Pointer Department of Computer Engineering 1/46 Outline Defining and using Pointers
More informationComputer Programming. Decision Making (2) Loops
Computer Programming Decision Making (2) Loops Topics The Conditional Execution of C Statements (review) Making a Decision (review) If Statement (review) Switch-case Repeating Statements while loop Examples
More informationSchool of Computer Science Introduction to Algorithms and Programming Winter Midterm Examination # 1 Wednesday, February 11, 2015
Page 1 of 8 School of Computer Science 60-141-01 Introduction to Algorithms and Programming Winter 2015 Midterm Examination # 1 Wednesday, February 11, 2015 Marking Exemplar Duration of examination: 75
More informationIntroduction to Programming
Introduction to Programming Lecture 5: Interaction Interaction Produce output Get input values 2 Interaction Produce output Get input values 3 Printing Printing messages printf("this is message \n"); Printing
More informationDEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING PROGRAMMING TECHNIQUES I EE271
UNIVERSITY OF SWAZILAND FACULTY OF SCIENCE AND ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING MAIN EXAMINATION: 2015 TITLE OF PAPER: COURSE NUMBER: TIME ALLOWED: PROGRAMMING TECHNIQUES
More informationConditional Statement
Conditional Statement 1 Conditional Statements Allow different sets of instructions to be executed depending on truth or falsity of a logical condition Also called Branching How do we specify conditions?
More informationMidterm Exam 2 Solutions, C programming
Midterm Exam 2 Solutions, C programming April 26, 2010 Rules: Open book, open notes, open any printed or handwritten material. No electronic devices (except a music player). If you use a music player nobody
More informationPractice Sheet #07 with Solutions
Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Practice Sheet #07 with Solutions Topic: Pointer in C Date: 23-02-2017 1 Assume the following C variable declaration
More informationNCSU ECE 209 Sections 602 Exam 1 Fall September, I have neither given not received unauthorized assistance on this test.
NCSU ECE 209 Sections 602 Exam 1 Fall 2009 29 September, 2009 This is a closed book and closed notes exam. It is to be turned in by 5:45 pm. Calculators, PDA's, cell phones, and any other electronic or
More informationSample Examination. Family Name:... Other Names:... Signature:... Student Number:...
Family Name:... Other Names:... Signature:... Student Number:... THE UNIVERSITY OF NEW SOUTH WALES SCHOOL OF COMPUTER SCIENCE AND ENGINEERING Sample Examination COMP1917 Computing 1 EXAM DURATION: 2 HOURS
More informationDecision Making and Loops
Decision Making and Loops Goals of this section Continue looking at decision structures - switch control structures -if-else-if control structures Introduce looping -while loop -do-while loop -simple for
More informationStructured programming
Exercises 6 Version 1.0, 25 October, 2016 Table of Contents 1. Arrays []................................................................... 1 1.1. Declaring arrays.........................................................
More informationECE15: Introduction to Computer Programming Using the C Language Lecture 6: Arrays
ECE15: Introduction to Computer Programming Using the C Language Lecture 6: Arrays A. Orlitsky and A. Vardy, based in part on slides by S. Arzi, G. Ruckenstein, E. Avior, S. Asmir, and M. Elad Outline
More informationECE15: Introduction to Computer Programming Using the C Language. Lecture Unit 4: Flow of Control
ECE15: Introduction to Computer Programming Using the C Language Lecture Unit 4: Flow of Control Outline of this Lecture Examples of Statements in C Conditional Statements The if-else Conditional Statement
More informationonly in the space provided. Do the rough work in the space provided for it. The question paper has total 12 pages.
Instructions: Answer all five questions. Total marks = 10 x 2 + 4 x 10 = 60. Time = 2hrs. Write your answer only in the space provided. Do the rough work in the space provided for it. The question paper
More information