#include <iostream> using namespace std; #include <iostream> using namespace std;
|
|
- Alexia Lydia Newman
- 6 years ago
- Views:
Transcription
1 GRUPPE 1 Frage 1 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit int f(int k) if (k) cout << "A"; else cout << "B"; return k*2; cout << (f(0) + f(3)); int f(int k) if (k) cout << "X"; else cout << "Y"; return k*2; cout << (f(3) - f(0));
2 GRUPPE 1 Frage 2 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit class X char *p; X(char *p) this->p=p; void print() cout<<p; void cp(const X& x) p[0] = x.p[1]; x.p[0] = 'X'; ; char str[]="zander"; X x(str+2),y(str); x.cp(y); x.print(); y.print(); cout << str; class Y char *p; Y(char *p) this->p=p; void print() cout<<p; void cp(const Y& y) y.p[1] = p[0]; p[1] = 'Y'; ; char str[]="braten"; Y x(str+2), y(str); x.cp(y); x.print(); y.print(); cout << str;
3 GRUPPE 1 Frage 3 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit int f(int n) return (n + 3) % 5; int a[] = 7,1,6,5,4; int f(int n) return (n + 3) % 5; int a[] = 4,2,0,1,7; for (int i=2; i!=3; i=f(i)) cout << a[i]; for (int i=1; i!=2; i=f(i)) cout << a[i];
4 GRUPPE 1 Frage 4 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit int a = 1; int b = 2; int c = 3; if (a<b &&!(b>c)) cout << "JA"; else cout << "NEIN"; cout << a << b << c; int a = 4; int b = 5; int c = 6; if (a<b!(b>c)) cout << "YES"; else cout << "NO"; cout << a << b << c;
5 GRUPPE 1 Frage 5 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit int n = 0; int n = 0; class X int no; X(): no(++n) ~X() cout << no; ; void f(x x1, X &x2) X x3; X a; X b, c; f(b, c); X d; class Y int no; Y(): no(n++) ~Y() cout << no; ; void f(y y1, Y &y2) Y y3; Y a, b; f(a, b); Y c; Y d;
6 GRUPPE 1 Frage 6 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit class X int x; X(int a = 1) x = a; void print() cout << x; X calc() this->x *= 2; X res(this->x + 1); return res; ; class Y int y; Y(int a = 2) y = a; void print() cout << y; Y calc() this->y *= 2; Y res(this->y + 1); return res; ; X a; a.calc().print(); a.print(); Y a; a.calc().print(); a.print();
7 GRUPPE 1 Frage 7 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit void f(int a, int &b) cout << ++a << b--; void f(int &a, int b) cout << a++ << --b; int a = 1; int b = 2; cout << a << b; f(a,b); cout << a << b; int a = 3; int b = 4; cout << a << b; f(a,b); cout << a << b;
8 GRUPPE 1 Frage 8 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit class X int a; X(int n=1):a(n) cout << a; ~X() cout << a; ; class X int a; X(int n=2):a(n) cout << a; ~X() cout << a; ; class Y X x1; X x2; Y (): x2(5) x1=x2; ; X x = 8; Y y; class Y X x1; X x2; Y (): x2(3) x1=x2; ; X x = 6; Y y;
9 GRUPPE 1 Frage 9 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit int h(int n) return n * 2; int g(int n) return n + 2; int f(int n) return n - 2; int h(int n) return n * 2; int g(int n) return n - 2; int f(int n) return n + 2; cout << f(7); cout << g(6); cout << h(5); cout << f(4); cout << g(5); cout << h(6);
10 GRUPPE 1 Frage 10 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit char str[] = "KAKAO"; char *p1 = str; char *p2 = p1+4; while (p1!= p2) cout << *p1 << *p2; p1 = p1 + 1; p2 = p2 1; char str[] = "RADAU"; char *p1 = str; char *p2 = p1+4; while (p1!= p2) cout << *p1 << *p2; p1 = p1 + 1; p2 = p2 1;
11 Test - Ende Geben Sie Ihr Testformular unverzüglich ab, indem Sie es JETZT SOFORT (IN DIESEM MOMENT) zum rechten Rand Ihrer Sitzreihe weitergeben. Bitte nach RECHTS zum Rand weitergeben
12 GRUPPE 1 Frage 1 Zeit int f(int k) if (k) cout << "A"; else cout << "B"; return k*2; cout << (f(0) + f(3));??? int f(int k) if (k) cout << "X"; else cout << "Y"; return k*2; cout << (f(3) - f(0));???
13 GRUPPE 1 Frage 2 Zeit class X char *p; X(char *p) this->p=p; void print() cout<<p; void cp(const X& x) p[0] = x.p[1]; x.p[0] = 'X'; ; char str[]="zander"; X x(str+2),y(str); x.cp(y); x.print(); y.print(); cout << str; ADERXAADERXAADER class Y char *p; Y(char *p) this->p=p; void print() cout<<p; void cp(const Y& y) y.p[1] = p[0]; p[1] = 'Y'; ; char str[]="braten"; Y x(str+2), y(str); x.cp(y); x.print(); y.print(); cout << str; AYENBAAYENBAAYEN
14 GRUPPE 1 Frage 3 Zeit int f(int n) return (n + 3) % 5; int a[] = 7,1,6,5,4; int f(int n) return (n + 3) % 5; int a[] = 4,2,0,1,7; 67 for (int i=2; i!=3; i=f(i)) cout << a[i]; 27 for (int i=1; i!=2; i=f(i)) cout << a[i];
15 GRUPPE 1 Frage 4 Zeit int a = 1; int b = 2; int c = 3; if (a<b &&!(b>c)) cout << "JA"; else cout << "NEIN"; cout << a << b << c; JA123 int a = 4; int b = 5; int c = 6; if (a<b!(b>c)) cout << "YES"; else cout << "NO"; cout << a << b << c; YES456
16 GRUPPE 1 Frage 5 Zeit int n = 0; class X int no; X(): no(++n) ~X() cout << no; ; void f(x x1, X &x2) X x3; X a; X b, c; f(b, c); X d; int n = 0; class Y int no; Y(): no(n++) ~Y() cout << no; ; void f(y y1, Y &y2) Y y3; Y a, b; f(a, b); Y c; Y d;
17 GRUPPE 1 Frage 6 Zeit class X int x; X(int a = 1) x = a; void print() cout << x; X calc() this->x *= 2; X res(this->x + 1); return res; ; X a; a.calc().print(); a.print(); 32 class Y int y; Y(int a = 2) y = a; void print() cout << y; Y calc() this->y *= 2; Y res(this->y + 1); return res; ; Y a; a.calc().print(); a.print(); 54
18 GRUPPE 1 Frage 7 Zeit void f(int a, int &b) cout << ++a << b--; void f(int &a, int b) cout << a++ << --b; int a = 1; int b = 2; cout << a << b; f(a,b); cout << a << b; int a = 3; int b = 4; cout << a << b; f(a,b); cout << a << b;
19 GRUPPE 1 Frage 8 Zeit class X int a; X(int n=1):a(n) cout << a; ~X() cout << a; ; class Y X x1; X x2; Y (): x2(5) x1=x2; ; X x = 8; Y y; class X int a; X(int n=2):a(n) cout << a; ~X() cout << a; ; class Y X x1; X x2; Y (): x2(3) x1=x2; ; X x = 6; Y y;
20 GRUPPE 1 Frage 9 Zeit int h(int n) return n * 2; int g(int n) return n + 2; int f(int n) return n - 2; cout << f(7); cout << g(6); cout << h(5); int h(int n) return n * 2; int g(int n) return n - 2; int f(int n) return n + 2; cout << f(4); cout << g(5); cout << h(6);
21 GRUPPE 1 Frage 10 Zeit char str[] = "KAKAO"; char *p1 = str; char *p2 = p1+4; while (p1!= p2) cout << *p1 << *p2; p1 = p1 + 1; p2 = p2 1; KOAA char str[] = "RADAU"; char *p1 = str; char *p2 = p1+4; while (p1!= p2) cout << *p1 << *p2; p1 = p1 + 1; p2 = p2 1; RUAA
#include <iostream> using namespace std; #include <iostream> using namespace std;
GRUPPE 1 Frage 1 4:00 3:50 3:40 3:30 3:20 3:10 3:00 2:50 2:40 2:30 2:20 2:10 2:00 1:50 1:40 1:30 1:20 1:10 1:00 0:50 0:40 0:30 0:20 0:10 0:00 Zeit class X int x; X(int a = 5) x = a; void print() cout
More informationInstructions. This exam has 7 questions, worth 10 points each. You have 50 minutes.
COS 126 Written Exam 1 Spring 18 Instructions. This exam has 7 questions, worth 10 points each. You have 50 minutes. Resources. You may reference your optional one-sided 8.5-by-11 handwritten "cheat sheet"
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 information#include <iostream> #include <algorithm> #include <cmath> using namespace std; int f1(int x, int y) { return (double)(x/y); }
1. (9 pts) Show what will be output by the cout s in this program. As in normal program execution, any update to a variable should affect the next statement. (Note: boolalpha simply causes Booleans to
More informationPointers, References and Arrays
Dr. Roxana Dumitrescu Department of Mathematics King s College London email: roxana.dumitrescu@kcl.ac.uk Exercises C++ SHEET 2 Pointers, References and Arrays Problem 1. Declare int variables x and y and
More informationDepartment of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #07. Topic: Pointer in C Date:
Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Practice Sheet #07 Topic: Pointer in C Date: 23-02-2017 1. Assume the following C variable declaration int *A [10],
More informationRecursion. Data and File Structures Laboratory. DFS Lab (ISI) Recursion 1 / 20
Recursion Data and File Structures Laboratory http://www.isical.ac.in/~dfslab/2018/index.html DFS Lab (ISI) Recursion 1 / 20 Function calls 1 void main(void) 2 {... 3 u = f(x, y*z); 4... 5 } 6 7 int f(int
More informationExercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 3, 2017
Concepts of Object-Oriented Programming AS 2017 Exercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 3, 2017 Task 1 Consider the following C++ program: class X X(int p) : fx(p)
More informationMore Untyped Lambda Calculus & Simply Typed Lambda Calculus
Concepts in Programming Languages Recitation 6: More Untyped Lambda Calculus & Simply Typed Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky,
More informationExercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 3, 2017
Concepts of Object-Oriented Programming AS 2017 Exercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 3, 2017 Task 1 (from a previous exam) Consider the following C++ program: class
More information. p.1/23. Today. 1. Questions and discussion from lecture. 2. Type-checking Functions Arrays Records (maybe)
. p.1/23 Today 1. Questions and discussion from lecture. 2. Type-checking Functions Arrays Records (maybe) . p.2/23 Type-checking functions Aspects: Overview of checks 6, 7 Declaration header Declaration
More informationSummer II Midterm Part I - Algorithms - 3 points each
1 Summer II Midterm Part I - Algorithms - 3 points each a) RemoveNLastDigits returns the number passed in minus digitstoremove digitstoremove must be positive RemoveNLastDigits(123456,2) ==> 1234 RemoveNLastDigits(123456,5)
More informationC++ Basics. Brian A. Malloy. References Data Expressions Control Structures Functions. Slide 1 of 24. Go Back. Full Screen. Quit.
C++ Basics January 19, 2012 Brian A. Malloy Slide 1 of 24 1. Many find Deitel quintessentially readable; most find Stroustrup inscrutable and overbearing: Slide 2 of 24 1.1. Meyers Texts Two excellent
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 informationObject oriented programming
Elektrijada 2005 Task1: Object oriented programming Task2: Kopaonik Task3: Task4: Task5: Task6: Task7: Task1 Task2 Task3 Task4 Task5 Task6 Task7 Sum Task 1: What is the output of the following program?
More informationHong Kong University of Science and Technology COMP151: Object Oriented Programming
Hong Kong University of Science and Technology COMP151: Object Oriented Programming Spring 2002, Midterm Examination Monday 11 March, 7:15 9.00 PM Student Name: Student ID: Lab Section/TA Name: Instructions:
More informationPractice test for midterm 2
Practice test for midterm 2 April 9, 2 18 1 Functions Write a function which takes in two int parameters and returns their average. (Remember that if a function takes in parameters, it does not need to
More informationScope and Parameter Passing
Scope and Parameter Passing Lecture 16 Sections 6.5, 6.10, 6.13 Robb T. Koether Hampden-Sydney College Mon, Oct 7, 2013 Robb T. Koether (Hampden-Sydney College) Scope and Parameter Passing Mon, Oct 7,
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 informationCS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find
CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS
More informationExercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 4, 2016
Concepts of Object-Oriented Programming AS 2016 Exercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 4, 2016 Task 1 Consider the following C++ program: class X X(int p) : fx(p)
More informationGettysburg College Department of Computer Science
Gettysburg College Department of Computer Science CS 111 Exam 1 Oct 6, 2014 This exam is closed-book, closed-notes, closed-computers, closed-internet, closed-calculators, closed-devices, and closed-neighbors.
More informationType Inference Systems. Type Judgments. Deriving a Type Judgment. Deriving a Judgment. Hypothetical Type Judgments CS412/CS413
Type Inference Systems CS412/CS413 Introduction to Compilers Tim Teitelbaum Type inference systems define types for all legal programs in a language Type inference systems are to type-checking: As regular
More informationE.C. 2 E.C. 1 E.C.
Computer Chocolate Code-off: Rules: 1. Create one answer sheet with all group member names on it! (to be given to another group for grading No running code (you may use class notes) 2. You may ask yes/no
More informationScope and Parameter Passing
Scope and Parameter Passing Lecture 17 Sections 6.5, 6.10, 6.13 Robb T. Koether Hampden-Sydney College Fri, Oct 5, 2018 Robb T. Koether (Hampden-Sydney College) Scope and Parameter Passing Fri, Oct 5,
More informationCSci 1113 Midterm 1. Name: Student ID:
CSci 1113 Midterm 1 Name: Student ID: Instructions: Please pick and answer any 7 of the 9 problems for a total of 70 points. If you answer more than 7 problems, only the first 7 will be graded. The time
More informationStudent Name and ID CS 32, WINTER 2015, PRACTICE MIDTERM I.
UCLA Computer Science Department TA: Kung-Hua Chang Student Name and ID CS 32, WINTER 2015, PRACTICE MIDTERM I. Problem # Maximal Possible Points Received 1.1 3 1.2 5 1.3 5 1.4 5 1.5 5 2 3 3.1 4 3.2 5
More informationObject Oriented Programming Using C++ Mathematics & Computing IET, Katunayake
Assigning Values // Example 2.3(Mathematical operations in C++) float a; cout > a; cout
More informationMake sure the version number is marked on your scantron sheet. This is Version 1
Last Name First Name McGill ID Make sure the version number is marked on your scantron sheet. This is Version 1 McGill University COMP 208 -- Computers in Engineering Mid-Term Examination Tuesday, March
More informationENERGY 211 / CME 211. Functions
ENERGY 211 / CME 211 Lecture 8 October 8, 2008 1 Functions So far, we have seen programs in which all code resides within a main function Complex programs consist of subprograms that perform particular
More informationReview Summer CSC1322 Adv Programming in C++ Professor: Zhang
CSC1322 Adv Programming in C++ Professor: Zhang Review Summer 2014 Name: Score: Question Points Score 1 5 2 5 3 5 4 5 5 5 6 5 7 5 8 5 9 5 10 5 11 5 12 5 13 5 14 5 15 5 16 5 17 5 18 10 19 10 20 10 21 15
More informationRecursion. Data and File Structures Laboratory. DFS Lab (ISI) Recursion 1 / 27
Recursion Data and File Structures Laboratory http://www.isical.ac.in/~dfslab/2017/index.html DFS Lab (ISI) Recursion 1 / 27 Definition A recursive function is a function that calls itself. The task should
More informationCS-211 Fall 2017 Test 1 Version A Oct. 2, Name:
CS-211 Fall 2017 Test 1 Version A Oct. 2, 2017 True/False Questions... Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : If I code a C
More informationProgramming Fundamentals II (C++ II) Final Exam June 17 th, Sun, 2007
Programming Fundamentals II (C++ II) Final Exam June 17 th, Sun, 2007 NAME:...Number:... Question 1 Define class section that has the following attributes: coursename, coursenumber as integer, credithours
More informationAgenda. The main body and cout. Fundamental data types. Declarations and definitions. Control structures
The main body and cout Agenda 1 Fundamental data types Declarations and definitions Control structures References, pass-by-value vs pass-by-references The main body and cout 2 C++ IS AN OO EXTENSION OF
More informationIslamic University of Gaza Faculty of Engineering Computer Engineering Department
Student Mark Islamic University of Gaza Faculty of Engineering Computer Engineering Department Question # 1 / 18 Question # / 1 Total ( 0 ) Student Information ID Name Answer keys Sector A B C D E A B
More informationIntroduction to Programming. Lecture 6: Functions & Program Structure
Introduction to Programming Lecture 6: Functions & Program Structure Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Arrays Review of Chapter 5 Initialization Multi-dimensional arrays More Operators Assignment
More informationCSE 333 Midterm Exam 7/27/15 Sample Solution
Question 1. (24 points) C programming. In this problem we want to implement a set of strings in C. A set is represented as a linked list of strings with no duplicate values. The nodes in the list are defined
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 25, 2017 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Function Details Assert Statements
More informationWrite the names of the header files to which the following belong :
Write the names of the header files to which the following belong : (i) puts( ) (ii) sin( ). What is the difference between call by value and call by reference? Give an example in C++ illustrate both.
More informationCSE 130, Fall 2006: Final Examination
CSE 130, Fall 2006: Final Examination Name: ID: Instructions, etc. 1. Write your answers in the space provided. 2. Wherever it says explain, write no more than three lines as explanation. The rest will
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 informationCS 0449 Sample Midterm
Name: CS 0449 Sample Midterm Multiple Choice 1.) Given char *a = Hello ; char *b = World;, which of the following would result in an error? A) strlen(a) B) strcpy(a, b) C) strcmp(a, b) D) strstr(a, b)
More informationCSC 221: Computer Organization, Spring 2009
1 of 7 4/17/2009 10:52 AM Overview Schedule Resources Assignments Home CSC 221: Computer Organization, Spring 2009 Practice Exam 2 Solutions The exam will be open-book, so that you don't have to memorize
More informationE.C. 2 E.C. 1 E.C.
Computer Chocolate Code-off: Rules: 1. Create one answer sheet with all group member names on it! (to be given to another group for grading No running code (you may use class notes) 2. You may ask yes/no
More informationCSC240 Static method, array, and loop.
CSC240 Static method, array, and loop. 1. Tracing programs Code public class Quiz1 public static void main(string [] args) String x = mystery("00"); public static String mystery(string s) s = s + "7";
More informationTypes. Type checking. Why Do We Need Type Systems? Types and Operations. What is a type? Consensus
Types Type checking What is a type? The notion varies from language to language Consensus A set of values A set of operations on those values Classes are one instantiation of the modern notion of type
More informationCSE373 Midterm I Fall 2009 (Closed book, closed notes)
CSE373 Midterm I Fall 2009 (Closed book, closed notes) Name:... Problem Points Q1 [20 points] Q2 [15 points] Q3 [15 points] Q4 [10 points] Q5 [15 points] Q6 [25 points] Total [100 points] 1 1 [20 points]
More informationCMSC 330: Organization of Programming Languages. Lets, Tuples, Records
CMSC 330: Organization of Programming Languages Lets, Tuples, Records CMSC330 Spring 2018 1 Let Expressions Enable binding variables in other expressions These are different from the let definitions we
More informationMidterm 2 Solutions Many acceptable answers; one was the following: (defparameter g1
Midterm 2 Solutions 1. [20 points] Consider the language that consist of possibly empty lists of the identifier x enclosed by parentheses and separated by commas. The language includes { () (x) (x,x) (x,x,x)
More informationcs242 Kathleen Fisher Reading: Concepts in Programming Languages, Chapter 6 Thanks to John Mitchell for some of these slides.
cs242 Kathleen Fisher Reading: Concepts in Programming Languages, Chapter 6 Thanks to John Mitchell for some of these slides. We are looking for homework graders. If you are interested, send mail to cs242cs.stanford.edu
More informationFORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam II:
FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): 1. The declaration below declares three pointer variables of type pointer to double that is
More informationLOWELL WEEKLY JOURNAL
Y $ b b Y b Y F Q Q Y 2 F {»» ( 2 Y b b b ] F F b / b b F q x x ) b Y b? F ( ) x _ q ( b b» ZZ F $ b b» b 6 2 q b x =2 2 6 2 b 2 2 bb b b? [ b q {» ( b b b ( x b $ b F b b q b b b q F b Y F b Y Y z b b
More informationWhat does this print?
public class Test_Static { int a; static int b; public Test_Static(int av, int bv) { a= av; b= bv; } public void print() { System.out.println ("a= " + a + " b= " + b); } public static void main (String
More informationCSE 130, Fall 2005: Final Examination
CSE 130, Fall 2005: Final Examination Name: ID: Instructions, etc. 1. Write your answers in the space provided. 2. Wherever it says explain, write no more than three lines as explanation. The rest will
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 informationC and C++ I. Spring 2014 Carola Wenk
C and C++ I Spring 2014 Carola Wenk Different Languages Python sum = 0 i = 1 while (i
More informationChocolate Code-Off!! First Chocolate Code-off for CISC220 Fall 18
Chocolate Code-Off!! First Chocolate Code-off for CISC220 Fall 18 Instructions: 1. Get into groups of 3 or 4 people 2. Create one answer sheet with all group member names on it! (to be given to another
More informationCS 223: Data Structures and Programming Techniques. Exam 2
CS 223: Data Structures and Programming Techniques. Exam 2 Instructor: Jim Aspnes Work alone. Do not use any notes or books. You have approximately 75 minutes to complete this exam. Please write your answers
More informationCSCE 110 Dr. Amr Goneid Exercise Sheet (7): Exercises on Recursion
CSCE 110 Dr. Amr Goneid Exercise Sheet (7): Exercises on Recursion Consider the following recursive function: int what ( int x, int y) if (x > y) return what (x-y, y); else if (y > x) return what (x, y-x);
More informationint f(char a, char b) {
Polymorphism Chapter Eight Modern Programming Languages 1 Introduction Compare these function types The ML function is more flexible, since it can be applied to any pair of the same (equality-testable)
More informationCS536 Spring 2011 FINAL ID: Page 2 of 11
CS536 Spring 2011 FINAL ID: Page 2 of 11 Question 2. (30 POINTS) Consider adding forward function declarations to the Little language. A forward function declaration is a function header (including its
More informationFinal Intro to C Review
Final Exam Content: Final Intro to C Review - Pass by reference Functions - General Syntax - Structures - Recursion(maybe?) - Programming by nature is cumulative so any past material is up for grabs as
More informationtypedef Labeling<unsigned char,short> LabelingBS; typedef Labeling<unsigned char,short>::regioninfo RegionInfoBS;
2005 7 19 1 ( ) Labeling 2 C++ STL(Standard Template Library) g++ (GCC) 3.3.2 3 3.1 Labeling SrcT DstT SrcT: unsigned char, shoft DstT: short typedef 1. unsigned char, short typedef Labeling
More informationECE Fall 2017, Third Exam
ECE 30862 Fall 2017, Third Exam DO NOT START WORKING ON THIS UNTIL TOLD TO DO SO. LEAVE IT ON THE DESK. THE LAST PAGE IS THE ANSWER SHEET. TEAR IT OFF AND PUT ALL ANSWERS THERE. TURN IN BOTH PARTS OF THE
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 informationThe University of Nottingham
The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER 2011-2012 G52CPP C++ Programming Examination Time allowed TWO hours Candidates may complete the front cover of
More informationComma C/C++ A parallel programming language
Comma C/C++ A parallel programming language By Steve Casselman CEO and Founder Comma Corp. Parallel Computing Technology 5/14/2014 Comma Corp 1 Computers and compilers evolved together First there was
More informationEngineering Problem Solving with C++, Etter
Engineering Problem Solving with C++, Etter Chapter 6 Strings 11-30-12 1 One Dimensional Arrays Character Strings The string Class. 2 C style strings functions defined in cstring CHARACTER STRINGS 3 C
More informationExam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80
Exam 2 CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson Question Points Score 1 18 2 29 3 18 4 15 Total: 80 I understand that this exam is closed book and closed note and
More informationPolymorphism. Zimmer CSCI 330
Polymorphism Polymorphism - is the property of OOP that allows the run-time binding of a function's name to the code that implements the function. (Run-time binding to the starting address of the code.)
More informationKENDRIYA VIDYALAYA PANGODE MONTHLY TEST I JUNE 2015 CLASS XII COMPUTER SCIENCE Time allowed: 1 1/2 Hours Max. Marks: 50
KENDRIYA VIDYALAYA PANGODE MONTHLY TEST I JUNE 2015 CLASS XII COMPUTER SCIENCE Time allowed: 1 1/2 Hours Max. Marks: 50 General Instructions: 1. All questions are compulsory. 2. Marks for each question
More informationMATH 142 Business Mathematics II
MATH 142 Business Mathematics II Summer, 2016, WEEK 5 JoungDong Kim Week 5: 8.1, 8.2, 8.3 Chapter 8 Functions of Several Variables Section 8.1 Functions of several Variables Definition. An equation of
More informationPolymorphism. Chapter Eight Modern Programming Languages, 2nd ed. 1
Polymorphism Chapter Eight Modern Programming Languages, 2nd ed. 1 Introduction Compare these function types The ML function is more flexible, since it can be applied to any pair of the same (equality-testable)
More information1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.
1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format
More informationCS202 Compiler Construction
CS202 Compiler Construction April 17, 2003 CS 202-33 1 Today: more optimizations Loop optimizations: induction variables New DF analysis: available expressions Common subexpression elimination Copy propogation
More information3/12/2018. Structures. Programming in C++ Sequential Branching Repeating. Loops (Repetition)
Structures Programming in C++ Sequential Branching Repeating Loops (Repetition) 2 1 Loops Repetition is referred to the ability of repeating a statement or a set of statements as many times this is necessary.
More informationHomework: Study 6.1 # 1, 5, 7, 13, 25, 19; 3, 17, 27, 53
January, 7 Goals:. Remember that the area under a curve is the sum of the areas of an infinite number of rectangles. Understand the approach to finding the area between curves.. Be able to identify the
More informationTypes, Type Inference and Unification
Types, Type Inference and Unification Mooly Sagiv Slides by Kathleen Fisher and John Mitchell Cornell CS 6110 Summary (Functional Programming) Lambda Calculus Basic ML Advanced ML: Modules, References,
More informationCSCI2467: Systems Programming Concepts
CSCI2467: Systems Programming Concepts In Class: alignment activity followup Instructor: Matthew Toups Fall 2017 Today 1 2 Array question Identifier address (hex) type value (decimal) value (hex) myclasses
More informationRushikesh K Joshi. Department of Computer Science and Engineering Indian Institute of Technology Bombay
CS 617 Object Oriented Systems Lecture 9 Polymorphism: Mere Syntactic Vs. Dynamic Binding,, Subsumption Covariance, Contravariance 3:30-5:00 pm Thu, Jan 31 Rushikesh K Joshi Department of Computer Science
More informationCS-211 Fall 2017 Test 1 Version Practice For Test on Oct. 2, Name:
CS-211 Fall 2017 Test 1 Version Practice For Test on Oct. 2, 2017 True/False Questions... Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a)
More informationCSCE 110 Dr. Amr Goneid Exercise Sheet (7): Exercises on Recursion (Solutions)
CSCE 110 Dr. Amr Goneid Exercise Sheet (7): Exercises on Recursion (Solutions) Consider the following recursive function: int what ( int x, int y) if (x > y) return what (x-y, y); else if (y > x) return
More informationContents Lecture 3. C Preprocessor, Chapter 11 Declarations, Chapter 8. Jonas Skeppstedt Lecture / 44
Contents Lecture 3 C Preprocessor, Chapter 11 Declarations, Chapter 8 Jonas Skeppstedt (js@cs.lth.se) Lecture 3 2014 1 / 44 C Preprocessor Predefined macros Macro replacement Conditional inclusion Source
More informationFORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each):
FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam II: True (A)/False(B) (2 pts each): 1. When you attach & after the datatype in the parameter list of a function, the variable following
More informationخ ث ح 13:10 14:00 خ ث ح 51:51 16:11 ر ن 09:41 11:11 ر ن
Philadelphia University Faculty of Engineering Department of Computer Engineering Programming Language (630263) Date:- 07/02/2015 Allowed time:- 2 Hours Final Exam Student Name: -... ID: - Instructor:
More informationTic Tac Toe Game! Day 8
Tic Tac Toe Game! Day 8 Game Description We will be working on an implementation of a Tic-Tac-Toe Game. This is designed as a two-player game. As you get more involved in programming, you might learn how
More informationAssigning to a Variable
What is the result of this program? Is it 0 or 1? Assigning to a Variable let f = proc(x) set x = 1 in let y = 0 in { (f y); y } 1 Assigning to a Variable let f = proc(x) set x = 1 in let y = 0 in { (f
More informationC++ Exception Handling. Dr. Md. Humayun Kabir CSE Department, BUET
C++ Exception Handling Dr. Md. Humayun Kabir CSE Department, BUET Exception Handling 2 An exception is an unusual behavior of a program during its execution Exception can occur due to Wrong user input
More informationCOP 3223 Section 4 Exam #2 Form A Multiple Choice Fall /1/2014
COP 3223 Section 4 Exam #2 Form A Multiple Choice Fall 2014 11/1/2014 Lecturer: Arup Guha Directions: Answer all multiple choice questions on the scantron. Each question has a single correct answer. In
More informationData-Flow Analysis Foundations
CS 301 Spring 2016 Meetings April 11 Data-Flow Foundations Plan Source Program Lexical Syntax Semantic Intermediate Code Generation Machine- Independent Optimization Code Generation Target Program This
More informationPage 1 Name: CUNYfirstID: CS111 Summer Term 2 - Final 6/26/18
Page 1 Section I Basic Questions 1,2,3 are required to be correctly answered to obtain a grade higher than C-. Part 1 Questions are worth 10 points each. 1) // counts number of items in array that are
More informationLecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8
Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How
More informationCSc 372, Fall 1996 Mid-Term Examination Monday, October 21, 1996 READ THIS FIRST
CSc 372, Fall 1996 Mid-Term Examination Monday, October 21, 1996 READ THIS FIRST Do not turn this page until you are told to begin. This examination consists of nine problems and an extra credit section
More informationLab Instructor : Jean Lai
Lab Instructor : Jean Lai Group related statements to perform a specific task. Structure the program (No duplicate codes!) Must be declared before used. Can be invoked (called) as any number of times.
More informationCUTE: A Concolic Unit Testing Engine for C
CUTE: A Concolic Unit Testing Engine for C Koushik Sen Darko Marinov Gul Agha University of Illinois Urbana-Champaign Goal Automated Scalable Unit Testing of real-world C Programs Generate test inputs
More information#3. (Recursion) Write a recursive function to compute f(x) = f(x - 1) + f(x - 2) with f(0) = 0 and f(1) = 1.
EGN 3210 Sample Test 2 Dr. Fernando Gonzalez NAME S.S.# #1. (Functions) Write a function that receives 3 integers, and returns the value of the largest one through the function name. #2. (Functions) What
More informationSFU CMPT Topic: Classes
SFU CMPT-212 2008-1 1 Topic: Classes SFU CMPT-212 2008-1 Topic: Classes Ján Maňuch E-mail: jmanuch@sfu.ca Friday 15 th February, 2008 SFU CMPT-212 2008-1 2 Topic: Classes Encapsulation Using global variables
More informationCSCE 110 Notes on Recursive Algorithms (Part 12) Prof. Amr Goneid
CSCE 110 Notes on Recursive Algorithms (Part 12) Prof. Amr Goneid 1. Definition: The expression Recursion is derived from Latin: Re- = back and currere = to run, or to happen again, especially at repeated
More informationInformation Security CS526
Information Security CS 526 Topic 20: Non-interference and Nondeducibility 1 Optional Readings for This Lecture Security Policies and Security Models. J.A.Goguen and J.Meseguer. Oakland 1982 Non-deducibility
More information