Computer Systems and Networks
|
|
- Clement Francis
- 6 years ago
- Views:
Transcription
1 LECTURE 6: C PROGRAMMING Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) University of the Pacific
2 Today s Class o Recap from last class o File I/O o What happens during a malloc and free o String Operations
3 void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp;
4 Let s execute the three iteragons
5 void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 0 nothing yet
6 void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 0 nothing yet
7 void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 0 nothing yet
8 void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 0 nothing yet
9 head tail void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 0 nothing yet
10 head tail temp void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 1 one item on the list
11 head tail temp void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 1 one item on the list
12 head temp tail void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 1 one item on the list
13 head temp tail void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 1 one item on the list
14 head temp tail void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 1 one item on the list
15 head tail void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 1 one item on the list
16 head tail temp void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 2 two items on the list
17 head tail temp void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 2 two items on the list
18 head tail t temp void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 2 two items on the list
19 head tail temp void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 2 two items on the list
20 head tail temp void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 2 two items on the list
21 head tail void create_list(struct double_list **head, struct double_list **tail, struct coordinate ) //call by reference if(*head) //nothing on the list yet (*head)(struct double_list *)malloc(sizeof(struct double_list)); (*head)->; (*head)->prev; (*head)->coord; (*tail)(*head); //tail and head are same when only 1 item else temp (struct double_list *)malloc(sizeof(struct double_list)); temp-> ; temp->previous *tail; temp->coord; (*tail)-> temp; (*tail)temp; iteration 2 two items on the list
22 and so on!
23 Let us simulate a queue (FIFO list). The linked list function we wrote already creates a queue. Write a C function that returns the first element (struct coordinate type), removes the node, and adjusts the linked list.
24 struct coordinate exit_queue(struct double_list **head) // call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ;
25 head tail struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; Let s call this function three times
26 head temp tail struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; first call
27 head temp struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; first call
28 temp tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; first call
29 head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; first call
30 head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; first call
31 head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; first call
32 head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; first call
33 temp head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; second call
34 temp head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; second call
35 temp struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail head if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; second call
36 tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; second call
37 tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; second call
38 tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; second call
39 struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; tail head if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; second call
40 tail temp head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; third call
41 tail temp head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; third call
42 tail temp struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; head if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; third call
43 tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; third call
44 tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; third call
45 tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; third call
46 tail head struct coordinate exit_queue(struct double_list **head) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; return ; what will happen on the fourth call?
47 DO NOT want program to access tail either head struct coordinate exit_queue(struct double_list **head, struct double_list **tail) //call by reference struct coordinate ; temp*head; if(temp) //nothing on the list yet printf( \n Nothing to exit.. ); exit(0); else temp->coord; (*head)(*head)->; free(temp); if((*head)!) (*head)->prev; else (*tail); return ; tail
48 Problem 1 How would you modify the exit_queue function to simulate a stack function, pop()?
49 File I/O
50 #include<stdio.h> int main() FILE *ptr_file; char buf[1000]; ptr_file fopen("input.txt","r"); if (!ptr_file) return 1; while (fgets(buf,1000, ptr_file)!) printf("%s",buf); fclose(ptr_file); return 0;
51 Problem 2: File I/O FuncGons o fopen opens a text file. o fclose closes a text file. o feof o fgets reads a string from a file. o fwrite o fgetc reads a character from a file. o fputc prints a character to a file.
52 C program memory management
53 Memory Management OS creates virtual memory space for process when started Region is huge (full 32 or 64 bit space) Not fully mapped to physical memory Otherwise you could only fit 1 program in memory 0xFFFFFFFFFFFFFFFF (32 or 64 bit) Virtual Memory Space for new process 0x
54 Memory Management OS loads in the program from disk Text region Program code Data region Program fixed data 0xFFFFFFFFFFFFFFFF (32 or 64 bit) Data (Program data) Text (Program code) 0x
55 Memory Management Stack created to track program funcmon calls and local variables 0xFFFFFFFFFFFFFFFF (32 or 64 bit) Stack Data (Program data) Text (Program code) 0x
56 Memory Management Heap created to store dynamic memory from malloc()and related funcmons Not to scale this unused region is huge! 0xFFFFFFFFFFFFFFFF (32 or 64 bit) Stack (Unused / unmapped virtual memory) Heap Data (Program data) Text (Program code) 0x
57 Memory Management Program starts running malloc() allocates some memory 0xFFFFFFFFFFFFFFFF (32 or 64 bit) Stack (Unused / unmapped virtual memory) Heap Data (Program data) Text (Program code) 0x
58 Memory Management Original heap space eventually fills up malloc() requests addimonal space from the kernel by using brk() system call New spac e 0xFFFFFFFFFFFFFFFF (32 or 64 bit) Stack (Unused / unmapped virtual memory) Heap Data (Program data) Text (Program code) 0x
59 Memory Management Program terminates OS expunges enmre virtual address space Everything is deleted 0xFFFFFFFFFFFFFFFF (32 or 64 bit) Stack (Unused / unmapped virtual memory) Heap Data (Program data) Text (Program code) 0x
60 String OperaGons
61 C Strings There is no such thing as a string in C! What do you get? An array of characters Terminated by the null character '\0' Must manipulate element by element Not enough room in the array? Need a bigger array
62 Arrays of Characters char phrase[]"math"; phrase phrase[0] phrase[1] phrase[2] phrase[3] phrase[4] M A T H \0 Null terminator character (End of string) 62
63 Arrays of Characters phrase char phrase[8]"math"; phrase[0] phrase[1] phrase[2] phrase[3] phrase[4] phrase[5] phrase[6] phrase[7] M A T H \0????????? printf("%s\n", phrase); Prints until it reaches the \0 character!
64 Problem Helpful Library for Character Arrays #include <string.h> Useful funcmons strcpy - strcmp strlen strcat -
65 String Copy char phrase1[] "Math"; char phrase2[8]; strcpy(phrase2, phrase1); phrase1 phrase1[0] phrase1[1] phrase1[2] phrase1[3] phrase1[4] M A T H \0 phrase2 phrase2[0] phrase2[1] phrase2[2] phrase2[3] phrase2[4] phrase2[5] phrase2[6] phrase2[7] M A T H \0?????????
66 String ConcatenaGon char phrase1[8] Comp ; char phrase2[] Sci ; strcat(phrase1, phrase2); phrase1 phrase1[0] phrase1[1] phrase1[2] phrase1[3] phrase1[4] C O M P S phrase1[5] phrase1[6] phrase1[7] C I \0 phrase2 phrase2[0] phrase2[1] phrase2[2] phrase2[3] S C I \0 You cannot do this: phrase2 phrase1+phrase2;
67 ctype Library Useful for character manipulamon #include <ctype.h> toupper(char) / tolower(char) Converts character to uppercase or lowercase Example: char c toupper('a'); printf("%c", c); // A
68 ctype Library isalpha(char) Is the character a le\er? isdigit(char) Is the character a number 0-9? isspace(char) Is the character whitespace? (space or newline character) ispunct(char) Is the character punctuamon? (technically, a visible character that is not whitespace, a le\er, or a number) and several other variamons
69 Problem 4: What is the output of the C snippet below? main( ) char s[ ] "CPP programmers! You know C!" ; printf ( "\n%s", &s[2] ) ; printf ( "\n%s", s ) ; printf ( "\n%c", s[2] ) ;
70 Problem 5: Write a C snippet to reverse a string char *string; printf( \n Enter the string %s,string); /* Your code snippet here */ printf( \n The reverse string is %s,string);
71 What s the Error? char *a malloc(128*sizeof(char)); char *b malloc(128*sizeof(char)); b a; free(a); free(b);
72 What s the (PotenGal) Error? char *a malloc(128*sizeof(char)); datalen <some value...> // Copy datalen bytes // starting at *data to *a memcpy(a, data, datalen);
73 What s the Error? ptr (char *) malloc(strlen(string_a)); strcpy(ptr, string_a);
74 In- class ParGcipaGon: What s the Error? int *get_ii() int ii 2; return ⅈ main() int *ii; ii get_ii();... Do stuff using ii pointer
75
76 You are ready for Lab 4!
77 Useful Knowledge Simple structures 2-D array dynamic allocation and access String manipulation functions PRE-LAB DUE ON 26 th September: * Everything except for the game logic. However, your program should repeatedly display the grid and terminate when the special word "exit" is entered by the user. I will perform the check-off.
Computer Systems and Networks
University of the Pacific LECTURE 6: C PROGRAMMING Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) Today s Class o What happens during a malloc and free o File I/O o String
More informationComputer Systems and Networks
University of the Pacific LECTURE 5: C PROGRAMMING Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) Today s Class o Pointer basics o Pointers and mul;- dimensional arrays
More informationELEC / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition
ELEC / COMP 177 Fall 2012 Some slides from Kurose and Ross, Computer Networking, 5 th Edition Prior experience in programming languages C++ programming? Java programming? C programming? Other languages?
More informationComputer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. C Programming
ECPE 170 Jeff Shafer University of the Pacific C Programming 2 Lab Schedule Ac>vi>es Assignments Due Today Today Friday Intro to C Programming Intro to Build Tools and Makefiles Lab Report for Lab 2 due
More informationComputer Systems and Networks. ECPE 170 University of the Pacific
ECPE 170 University of the Pacific C Programming 2 Lb Lab Schedule hdl Activities Assignments Due Today Today Intro to C Programming Intro to Build Tools and Makefiles Lab Report for Lab 1 due by 11:59pm
More informationCCE1111 Programming for Engineers [C Programming Language]
are collection of characters. Unfortunately C does not has a primitive data type for strings and therefore an array of characters is used to represent a string. The following code snippet illustrates a
More informationComputer Systems and Networks
LECTURE 7: PERFORMANCE MEASUREMENT Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) University of the Pacific Lab Schedule Today Lab 5 Performance Measurement is open Work
More informationSolution for Data Structure
Solution for Data Structure May 2016 INDEX Q1 a 2-3 b 4 c. 4-6 d 7 Q2- a 8-12 b 12-14 Q3 a 15-18 b 18-22 Q4- a 22-35 B..N.A Q5 a 36-38 b N.A Q6- a 39-42 b 43 1 www.brainheaters.in Q1) Ans: (a) Define ADT
More informationComputer Systems and Networks
University of the Pacific LECTURE 7: PERFORMANCE MEASUREMENT 13 TH FEB, 2018 Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) Lab Schedule Today Lab 5 Performance Measurement
More informationC mini reference. 5 Binary numbers 12
C mini reference Contents 1 Input/Output: stdio.h 2 1.1 int printf ( const char * format,... );......................... 2 1.2 int scanf ( const char * format,... );.......................... 2 1.3 char
More informationCS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco
CS 326 Operating Systems C Programming Greg Benson Department of Computer Science University of San Francisco Why C? Fast (good optimizing compilers) Not too high-level (Java, Python, Lisp) Not too low-level
More information211: Computer Architecture Summer 2016
211: Computer Architecture Summer 2016 Liu Liu Topic: C Programming Data Representation I/O: - (example) cprintf.c Memory: - memory address - stack / heap / constant space - basic data layout Pointer:
More informationModule III. Linear Data Structures and their Linked Storage Representation
Module III Linear Data Structures and their Linked Storage Representation 3.1 Linked List Linked list is the collection of inter connected nodes with a head node representing the first node and a tail
More informationBBM 201 DATA STRUCTURES
BBM 201 DATA STRUCTURES Lecture 8: Dynamically Allocated Linked Lists 2017-2018 Fall int x; x = 8; int A[4]; An array is stored as one contiguous block of memory. How can we add a fifth element to the
More informationC programming basics T3-1 -
C programming basics T3-1 - Outline 1. Introduction 2. Basic concepts 3. Functions 4. Data types 5. Control structures 6. Arrays and pointers 7. File management T3-2 - 3.1: Introduction T3-3 - Review of
More informationCS 222: Pointers and Manual Memory Management
CS 222: Pointers and Manual Memory Management Chris Kauffman Week 4-1 Logistics Reading Ch 8 (pointers) Review 6-7 as well Exam 1 Back Today Get it in class or during office hours later HW 3 due tonight
More informationLecture 17. Strings II. CptS 121 Summer 2016 Armen Abnousi
Lecture 17 Strings II CptS 121 Summer 2016 Armen Abnousi String concatenation Sometimes we want to put two strings next to each other to make one longer string. firstname = John lastname = Kennedy JohnKennedy
More informationChapter 2 (Dynamic variable (i.e. pointer), Static variable)
Chapter 2 (Dynamic variable (i.e. pointer), Static variable) August_04 A2. Identify and explain the error in the program below. [4] #include int *pptr; void fun1() { int num; num=25; pptr= #
More informationECE551 Midterm Version 2
Name: ECE551 Midterm Version 2 NetID: There are 7 questions, with the point values as shown below. You have 75 minutes with a total of 75 points. Pace yourself accordingly. This exam must be individual
More informationa) (5 points) What is the output of the following code sequence? int *ptr = 0x1050; printf ("%x\n", ptr--); printf ("%x\n", ptr);
Problem 1: Short Answers (25 points) a) (5 points) What is the output of the following code sequence? int *ptr = 0x1050; printf ("%x\n", ptr--); printf ("%x\n", ptr); b) (5 points) What are the three basic
More informationIntroduction to C/C++ Lecture 5 - String & its Manipulation
Introduction to C/C++ Lecture 5 - String & its Manipulation Rohit Sehgal Nishit Majithia Association of Computing Activities, Indian Institute of Technology,Kanpur rsehgal@cse.iitk.ac.in nishitm@cse.iitk.ac.in
More informationECE551 Midterm Version 1
Name: ECE551 Midterm Version 1 NetID: There are 7 questions, with the point values as shown below. You have 75 minutes with a total of 75 points. Pace yourself accordingly. This exam must be individual
More informationCS 241 Data Organization Binary Trees
CS 241 Data Organization Binary Trees Brooke Chenoweth University of New Mexico Fall 2017 Binary Tree: Kernighan and Ritchie 6.5 Read a file and count the occurrences of each word. now is the time for
More informationCSC 2400: Computer Systems. Arrays and Strings in C
CSC 2400: Computer Systems Arrays and Strings in C Lecture Overview Arrays! List of elements of the same type Strings! Array of characters ending in \0! Functions for manipulating strings 1 Arrays: C vs.
More informationMemory Allocation. General Questions
General Questions 1 Memory Allocation 1. Which header file should be included to use functions like malloc() and calloc()? A. memory.h B. stdlib.h C. string.h D. dos.h 2. What function should be used to
More informationCSC 2400: Computer Systems. Arrays and Strings in C
CSC 2400: Computer Systems Arrays and Strings in C Lecture Overview Arrays! List of elements of the same type Strings! Array of characters ending in \0! Functions for manipulating strings 1 Arrays in C
More informationPrograms in memory. The layout of memory is roughly:
Memory 1 Programs in memory 2 The layout of memory is roughly: Virtual memory means that memory is allocated in pages or segments, accessed as if adjacent - the platform looks after this, so your program
More informationThe combination of pointers, structs, and dynamic memory allocation allow for creation of data structures
Data Structures in C C Programming and Software Tools N.C. State Department of Computer Science Data Structures in C The combination of pointers, structs, and dynamic memory allocation allow for creation
More informationo Code, executable, and process o Main memory vs. virtual memory
Goals for Today s Lecture Memory Allocation Prof. David August COS 217 Behind the scenes of running a program o Code, executable, and process o Main memory vs. virtual memory Memory layout for UNIX processes,
More informationHeap Arrays. Steven R. Bagley
Heap Arrays Steven R. Bagley Recap Data is stored in variables Can be accessed by the variable name Or in an array, accessed by name and index a[42] = 35; Variables and arrays have a type int, char, double,
More informationSystems Programming. 08. Standard I/O Library. Alexander Holupirek
Systems Programming 08. Standard I/O Library Alexander Holupirek Database and Information Systems Group Department of Computer & Information Science University of Konstanz Summer Term 2008 Last lecture:
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 informationDynamic Memory CMSC 104 Spring 2014, Section 02, Lecture 24 Jason Tang
Dynamic Memory CMSC 104 Spring 2014, Section 02, Lecture 24 Jason Tang Topics Memory Lifetime Dynamic Memory Allocation Dynamic Memory Deallocation Variable Lifetime (Review) Lifetime refers to when the
More informationIntroduction to C Language (M3-R )
Introduction to C Language (M3-R4-01-18) 1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in OMR answer sheet supplied with the question paper, following
More informationCS 261 Fall Mike Lam, Professor. Structs and I/O
CS 261 Fall 2018 Mike Lam, Professor Structs and I/O Typedefs A typedef is a way to create a new type name Basically a synonym for another type Useful for shortening long types or providing more meaningful
More informationfopen() fclose() fgetc() fputc() fread() fwrite()
The ability to read data from and write data to files is the primary means of storing persistent data, data that does not disappear when your program stops running. The abstraction of files that C provides
More informationFiles and Streams Opening and Closing a File Reading/Writing Text Reading/Writing Raw Data Random Access Files. C File Processing CS 2060
CS 2060 Files and Streams Files are used for long-term storage of data (on a hard drive rather than in memory). Files and Streams Files are used for long-term storage of data (on a hard drive rather than
More informationFundamentals of Programming & Procedural Programming
Universität Duisburg-Essen PRACTICAL TRAINING TO THE LECTURE Fundamentals of Programming & Procedural Programming Session Seven: Strings and Files Name: First Name: Tutor: Matriculation-Number: Group-Number:
More informationExercise Session 3 Systems Programming and Computer Architecture
Systems Group Department of Computer Science ETH Zürich Exercise Session 3 Systems Programming and Computer Architecture Herbstsemester 2016 Agenda Review of Exercise 2 More on C-Programming Outlook to
More informationPRINCIPLES OF OPERATING SYSTEMS
PRINCIPLES OF OPERATING SYSTEMS Tutorial-1&2: C Review CPSC 457, Spring 2015 May 20-21, 2015 Department of Computer Science, University of Calgary Connecting to your VM Open a terminal (in your linux machine)
More informationIntroduction to file management
1 Introduction to file management Some application require input to be taken from a file and output is required to be stored in a file. The C language provides the facility of file input-output operations.
More informationProgramming in C. UVic SEng 265. Daniel M. German Department of Computer Science University of Victoria. October 23, 2002 Version: 1.
Programming in C UVic SEng 265 Daniel M. German Department of Computer Science University of Victoria October 23, 2002 Version: 1.00 11 1 Programming in C (1.00) dmgerman@uvic.ca Parameter passing C implements
More informationStandard C Library Functions
Demo lecture slides Although I will not usually give slides for demo lectures, the first two demo lectures involve practice with things which you should really know from G51PRG Since I covered much of
More information8. Characters, Strings and Files
REGZ9280: Global Education Short Course - Engineering 8. Characters, Strings and Files Reading: Moffat, Chapter 7, 11 REGZ9280 14s2 8. Characters and Arrays 1 ASCII The ASCII table gives a correspondence
More informationStructures, Pointers, Linked Lists
Lecture 6: Structures, Pointers, Linked Lists Reminder: Pointers and structures Pointers to structures Dynamic memory allocation: malloc Linked lists Ordered linked lists Double linked lists, Trees Reminder:
More informationDynamic memory. EECS 211 Winter 2019
Dynamic memory EECS 211 Winter 2019 2 Initial code setup $ cd eecs211 $ curl $URL211/lec/06dynamic.tgz tar zx $ cd 06dynamic 3 Oops! I made a mistake. In C, the declaration struct circle read_circle();
More informationContents. A Review of C language. Visual C Visual C++ 6.0
A Review of C language C++ Object Oriented Programming Pei-yih Ting NTOU CS Modified from www.cse.cuhk.edu.hk/~csc2520/tuto/csc2520_tuto01.ppt 1 2 3 4 5 6 7 8 9 10 Double click 11 12 Compile a single source
More informationCS240: Programming in C
CS240: Programming in C Lecture 13 si 14: Unix interface for working with files. Cristina Nita-Rotaru Lecture 13/Fall 2013 1 Working with Files (I/O) File system: specifies how the information is organized
More informationPointers (part 1) What are pointers? EECS We have seen pointers before. scanf( %f, &inches );! 25 September 2017
Pointers (part 1) EECS 2031 25 September 2017 1 What are pointers? We have seen pointers before. scanf( %f, &inches );! 2 1 Example char c; c = getchar(); printf( %c, c); char c; char *p; c = getchar();
More informationProcedural Programming & Fundamentals of Programming
& Fundamentals of Programming Exercise 4 (SS 2018) 12.06.2018 What will I learn in the 5. exercise Files Math functions Dynamic data structures (linked Lists) Exercise(s) 1 Files A file can be seen as
More informationWhat is recursion. WAP to find sum of n natural numbers using recursion (5)
DEC 2014 Q1 a What is recursion. WAP to find sum of n natural numbers using recursion (5) Recursion is a phenomenon in which a function calls itself. A function which calls itself is called recursive function.
More informationWhat Is Operating System? Operating Systems, System Calls, and Buffered I/O. Academic Computers in 1983 and Operating System
What Is Operating System? Operating Systems, System Calls, and Buffered I/O emacs gcc Browser DVD Player Operating System CS 217 1 Abstraction of hardware Virtualization Protection and security 2 Academic
More informationAryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9
Fundamental of C Programming Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Q2. Write down the C statement to calculate percentage where three subjects English, hindi, maths
More informationIntermediate Programming, Spring 2017*
600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general
More informationC Programming Basics II
C Programming Basics II Xianyi Zeng xzeng@utep.edu Department of Mathematical Sciences The University of Texas at El Paso. September 20, 2016. Pointers and Passing by Address Upon declaring a variable,
More informationCS107 Spring 2019, Lecture 4 C Strings
CS107 Spring 2019, Lecture 4 C Strings Reading: K&R (1.9, 5.5, Appendix B3) or Essential C section 3 This document is copyright (C) Stanford Computer Science and Nick Troccoli, licensed under Creative
More informationCSE 509: Computer Security
CSE 509: Computer Security Date: 2.16.2009 BUFFER OVERFLOWS: input data Server running a daemon Attacker Code The attacker sends data to the daemon process running at the server side and could thus trigger
More informationFOR Loop. FOR Loop has three parts:initialization,condition,increment. Syntax. for(initialization;condition;increment){ body;
CLASSROOM SESSION Loops in C Loops are used to repeat the execution of statement or blocks There are two types of loops 1.Entry Controlled For and While 2. Exit Controlled Do while FOR Loop FOR Loop has
More informationC Characters and Strings
CS 2060 Character handling The C Standard Library provides many functions for testing characters in ctype.h. int isdigit(int c); // is c a digit (0-9)? int isalpha(int c); // is c a letter? int isalnum(int
More informationCSC 1600 Memory Layout for Unix Processes"
CSC 16 Memory Layout for Unix Processes" 1 Lecture Goals" Behind the scenes of running a program" Code, executable, and process" Memory layout for UNIX processes, and relationship to C" : code and constant
More informationChapter 5. Section 5.4 The Common String Library Functions. CS 50 Hathairat Rattanasook
Chapter 5 Section 5.4 The Common String Library Functions CS 50 Hathairat Rattanasook Library Functions We already discussed the library function fgets() Library functions are available: to find the length
More informationLinked Lists in C and C++
Linked Lists in C and C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by
More informationThat means circular linked list is similar to the single linked list except that the last node points to the first node in the list.
Leaning Objective: In this Module you will be learning the following: Circular Linked Lists and it operations Introduction: Circular linked list is a sequence of elements in which every element has link
More informationFall 2018 Discussion 2: September 3, 2018
CS 61C C Basics Fall 2018 Discussion 2: September 3, 2018 1 C C is syntactically similar to Java, but there are a few key differences: 1. C is function-oriented, not object-oriented; there are no objects.
More informationCOMP1917: 09 Arrays and Strings
COMP1917: 09 Arrays and Strings Sim Mautner s.mautner@unsw.edu.au August 15, 2016 Sim Mautner (UNSW) COMP1917: 09 Arrays and Strings August 15, 2016 1 / 14 Arrays int sum(int n1, int n2); int sum(int n1,
More informationSignature: ECE 551 Midterm Exam
Name: ECE 551 Midterm Exam NetID: There are 7 questions, with the point values as shown below. You have 75 minutes with a total of 75 points. Pace yourself accordingly. This exam must be individual work.
More informationC Language: Review. INFO High Performance Scientific Computing. 26 septembre 2017
C Language: Review INFO0939 - High Performance Scientific Computing 26 septembre 2017 Data type int: Basic signed integer type. unsigned int: Basic unsigned (only positive) integer type. float: Real number,
More informationNaked C Lecture 6. File Operations and System Calls
Naked C Lecture 6 File Operations and System Calls 20 August 2012 Libc and Linking Libc is the standard C library Provides most of the basic functionality that we've been using String functions, fork,
More informationCalling Conventions. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See P&H 2.8 and 2.12
Calling Conventions Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 2.8 and 2.12 Goals for Today Calling Convention for Procedure Calls Enable code to be reused by allowing
More informationCS 322 Operating Systems Practice Midterm Questions
! CS 322 Operating Systems 1. Processes go through the following states in their lifetime. time slice ends Consider the following events and answer the questions that follow. Assume there are 5 processes,
More information(More) Fun with Pointers and Linked Lists! CS 16: Solving Problems with Computers I Lecture #17
(More) Fun with Pointers and Linked Lists! CS 16: Solving Problems with Computers I Lecture #17 Ziad Matni Dept. of Computer Science, UCSB Administrative Homework situation: Labs: NO MORE HOMEWORK! J Lab10
More informationCOL106: Data Structures and Algorithms. Ragesh Jaiswal, IIT Delhi
Stack and Queue How do we implement a Queue using Array? : A collection of nodes with linear ordering defined on them. Each node holds an element and points to the next node in the order. The first node
More informationComputer Security. Robust and secure programming in C. Marius Minea. 12 October 2017
Computer Security Robust and secure programming in C Marius Minea marius@cs.upt.ro 12 October 2017 In this lecture Write correct code minimizing risks with proper error handling avoiding security pitfalls
More informationPointers, Dynamic Data, and Reference Types
Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation The new operator The delete operator Dynamic Memory Allocation for Arrays 1 C++ Data Types simple
More informationCOMP 524 Spring 2018 Midterm Thursday, March 1
Name PID COMP 524 Spring 2018 Midterm Thursday, March 1 This exam is open note, open book and open computer. It is not open people. You are to submit this exam through gradescope. Resubmissions have been
More informationUsing Character Arrays. What is a String? Using Character Arrays. Using Strings Life is simpler with strings. #include <stdio.
What is a String? A string is actually a character array. You can use it like a regular array of characters. However, it has also some unique features that make string processing easy. Using Character
More informationLecture 9: File Processing. Quazi Rahman
60-141 Lecture 9: File Processing Quazi Rahman 1 Outlines Files Data Hierarchy File Operations Types of File Accessing Files 2 FILES Storage of data in variables, arrays or in any other data structures,
More informationLinked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra
Linked List in Data Structure By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List Like arrays, Linked List is a linear data
More informationLecture 8: Readin, Writin & Sortin. Wednesday, 04 March 2009
Lecture 8: Readin, Writin & Sortin CS209 : Algorithms and Scientific Computing Wednesday, 04 March 2009 CS209 Lecture 8: Readin, Writin & Sortin 1/25 This afternoon: Last week: Open a file and read its
More informationHomework 3 CS161 Computer Security, Fall 2008 Assigned 10/07/08 Due 10/13/08
Homework 3 CS161 Computer Security, Fall 2008 Assigned 10/07/08 Due 10/13/08 For your solutions you should submit a hard copy; either hand written pages stapled together or a print out of a typeset document
More information19-Nov CSCI 2132 Software Development Lecture 29: Linked Lists. Faculty of Computer Science, Dalhousie University Heap (Free Store)
Lecture 29 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 29: Linked Lists 19-Nov-2018 Location: Chemistry 125 Time: 12:35 13:25 Instructor: Vlado Keselj Previous
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 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 informationECE 2400 Computer Systems Programming Fall 2018 Topic 7: Concrete Data Types
ECE 2400 Computer Systems Programming Fall 2018 Topic 7: Concrete Data Types School of Electrical and Computer Engineering Cornell University revision: 2018-10-11-00-22 1 List CDTs 4 1.1. List CDT Interface.............................
More informationActually, C provides another type of variable which allows us to do just that. These are called dynamic variables.
When a program is run, memory space is immediately reserved for the variables defined in the program. This memory space is kept by the variables until the program terminates. These variables are called
More informationProcesses. Johan Montelius KTH
Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other
More informationGoals of this Lecture
I/O Management 1 Goals of this Lecture Help you to learn about: The Unix stream concept Standard C I/O functions Unix system-level functions for I/O How the standard C I/O functions use the Unix system-level
More informationCOSC345 Software Engineering. The Heap And Dynamic Memory Allocation
COSC345 Software Engineering The Heap And Dynamic Memory Allocation Outline Revision The programmer s view of memory Simple array-based memory allocation C memory allocation routines Virtual memory Swapping
More informationENEE 150: Intermediate Programming Concepts for Engineers Spring 2018 Handout #27. Midterm #2 Review
ENEE 150: Intermediate Programming Concepts for Engineers Spring 2018 Handout #27 Midterm #2 Review 1 Time and Location The midterm will be given in class during normal class hours, 11:00a.m.-12:15p.m.,
More informationA process. the stack
A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes
More information(6-1) Basics of a Queue. Instructor - Andrew S. O Fallon CptS 122 (September 26, 2018) Washington State University
(6-1) Basics of a Queue Instructor - Andrew S. O Fallon CptS 122 (September 26, 2018) Washington State University What is a Queue? 2 A linear data structure with a finite sequence of nodes, where nodes
More informationI/O Management! Goals of this Lecture!
I/O Management! 1 Goals of this Lecture! Help you to learn about:" The Unix stream concept" Standard C I/O functions" Unix system-level functions for I/O" How the standard C I/O functions use the Unix
More informationI/O Management! Goals of this Lecture!
I/O Management! 1 Goals of this Lecture! Help you to learn about:" The Unix stream concept" Standard C I/O functions" Unix system-level functions for I/O" How the standard C I/O functions use the Unix
More informationQuick review of previous lecture Ch6 Structure Ch7 I/O. EECS2031 Software Tools. C - Structures, Unions, Enums & Typedef (K&R Ch.
1 Quick review of previous lecture Ch6 Structure Ch7 I/O EECS2031 Software Tools C - Structures, Unions, Enums & Typedef (K&R Ch.6) Structures Basics: Declaration and assignment Structures and functions
More informationCSCE150A. Introduction. Basics. String Library. Substrings. Line Scanning. Sorting. Command Line Arguments. Misc CSCE150A. Introduction.
Chapter 9 Scanning Computer Science & Engineering 150A Problem Solving Using Computers Lecture 07 - Strings Stephen Scott (Adapted from Christopher M. Bourke) Scanning 9.1 String 9.2 Functions: Assignment
More informationMain Program. C Programming Notes. #include <stdio.h> main() { printf( Hello ); } Comments: /* comment */ //comment. Dr. Karne Towson University
C Programming Notes Dr. Karne Towson University Reference for C http://www.cplusplus.com/reference/ Main Program #include main() printf( Hello ); Comments: /* comment */ //comment 1 Data Types
More informationCS 31: Intro to Systems Pointers and Memory. Kevin Webb Swarthmore College October 2, 2018
CS 31: Intro to Systems Pointers and Memory Kevin Webb Swarthmore College October 2, 2018 Overview How to reference the location of a variable in memory Where variables are placed in memory How to make
More informationComputer Science & Engineering 150A Problem Solving Using Computers. Chapter 9. Strings. Notes. Notes. Notes. Lecture 07 - Strings
Computer Science & Engineering 150A Problem Solving Using Computers Lecture 07 - Strings Scanning Stephen Scott (Adapted from Christopher M. Bourke) 1 / 51 Fall 2009 cbourke@cse.unl.edu Chapter 9 Scanning
More informationMid-term Exam. Fall Semester 2017 KAIST EE209 Programming Structures for Electrical Engineering. Name: Student ID:
Fall Semester 2017 KAIST EE209 Programming Structures for Electrical Engineering Mid-term Exam Name: This exam is closed book and notes. Read the questions carefully and focus your answers on what has
More informationMid-term Exam. Fall Semester 2017 KAIST EE209 Programming Structures for Electrical Engineering. Name: Student ID:
Fall Semester 2017 KAIST EE209 Programming Structures for Electrical Engineering Mid-term Exam Name: This exam is closed book and notes. Read the questions carefully and focus your answers on what has
More information