New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Exam Study Guide

by: Nicolette Notetaker

Exam Study Guide 109

Nicolette Notetaker
GPA 3.5
Systems Software
Professor Femister

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Systems Software
Professor Femister
Study Guide
50 ?




Popular in Systems Software

Popular in Computer Science and Engineering

This 13 page Study Guide was uploaded by Nicolette Notetaker on Friday September 25, 2015. The Study Guide belongs to 109 at Lehigh University taught by Professor Femister in Fall 2015. Since its upload, it has received 13 views. For similar materials see Systems Software in Computer Science and Engineering at Lehigh University.


Reviews for Exam Study Guide


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/25/15
CSE 109 Notes Unix Commands ls lists contents of current directory ls l lists contents with full details permissions Is a list contents of current directory including invisible folders cd folder name change the current directory to foldername cd change current directory to parent folder pwd print path of current directory mkdir foldername makes new folder in current directory touch filename creates new empty file in current directory rn filename removes the file from the current directory mv filename foldername1foldername2 move copy and delete file cp foldernamefilename copy file from folder to current directory man command name displays manual pages for the command cat textfile copy textfile to standard out cmd1 cmd2 takes standard input from cmd1 and pipes it to standard input of cmd2 cmd1 gt outtxt takes standard input from cmd1 and redirects it to file outtxt more filename 1 page view of file wc filename prints number of lines words characters chmod 777 myfile set the permissions on myfile so that user group and others can read write and execute first column d directory directoryfolderhave slashes after name first group is permissions of owner for file 1 OWNER GROUP rread wwrite xexecute 2 GROUP r w X 3 WORLD rw x chmod 700 myfile all permissions for owner everyone else nothing chmod 500 myfile owner gets read and execute everyone else nothing chmod 744 myfile rest of world and group read permissions ZIPPING UP THE FILE tar czvf hw1targz Hw1 C Language No classes No methods just functions return O gt that means that this program exits normally if a string is simply an array of characters you know it ends bc there is a O at the end of the word as the next byte include gt this is similar to the import part of java ltiostreamgt filenameh ex function void hellovoid printf Helon indef NODEH define NODEH end unsigned gt String Functions sizeof string gt returns the size which includes the 0 byte at the end strlen string gt returns the length of the string 39 it i 013 n0Il39lquotl3939q39kv 01 uu m39 l3939l aquot n a Oll I ul v u 39 ll Iondtf mallocsizeof gt dynamically allocates memory free gt frees up the memory Example The strcpy facility copies character ltingx and llzcrclmc requires arguments of type char quot char 39Itrcpylchar 81 count char 82 printf gt print function follow string by n strcmp s1 2 gt compares the strings if they are equal 0 if s1 is shorterless than s2 1 or if s1 is greater than s2 1 strtokstr gt breaks up str based on the second character putcharchar ch gt prints out ch character Manipulating Strings char str1 Hello char str2 Goodbye char str14 INCLUDE O BYTE AT THE END strcpystring1string2 gt function that copies string on right to string on left strcatstring 1 string 2 gt concatenates both strings Strings ARENT IMMUTABLE printf s s osn str1 str strlen gt length strcmps1s2 gt compares strings char token strtoks while token NULL printf osn token token strtokNULL CLOSEST THING TO SPLIT this is all in ltstringhgt FILE nu 39Iuml cons clur restrict tilrun Came char 0 rootrttt nodal xnt CleaIIILI 39 t tc ctrunit 1M HuohirHJ 39 tonne snout r gt opens an existing file for input w gt creates a new file or truncate an existing one for output fgetschar 3 int n FlLE gt takes in a pointer to the beginning of a character array count n and input stream characters are read from the input stream into s until a newline is seem or end of file reached and s is returned fclosein variabe type of in gt pointer to a file to open a file you need a pointer to a file type def statement gt assign a new name to a datatype fopentieName r pass it the fiIeName r gt reads the file a gt append w gt write EOF gt end of file 71L 39cccn 1uttcaaot chz txlonIal quot Open lionso to input return NULL 1 prabzo 39I 73L 39t Ollha 0 1quot 39tuxtlnno tat7v light choke on A HUM 1100 quot 1t txzonguo o ITLLt filozono 395039 t tapcnottlonno39r39l f 39v at noon 0190 quot If W 0 HULL39 pvtnvttotdovr 39upon lnyultk39ok39l lotiod o n39 Ileneo ottorrot oxxnoti 013 I 1 clone zlol39XLl fl 0 Ccao 110 1 39u 1 a o O 1 it o NULL return 00 x 2340 tut c quot ottzo o 0 a frloooltl If to lnrv parlor vlooo tail639 J to am on Makefile OPTS g xc Wa Werror copy copyc gcc OPTS 0 copy copyc cat catc gcc OPTS 0 cat catc linecat inecatc gcc OPTS o linecat inecatc demo scanfprintfdemoc gcc OPTS 0 demo scanfprintfdemoc struct structc gcc OPTS o struct structc unions unionsc gcc OPTS o unions unionsc clean rm t o aout cat copy linecat demo struct unions make file consists of syntax target dependencies list of files gt if the dependencies have changed then we need to remake the target rebuilds the target checks dependencies only recompiles the one it needs to clean deletes 0 files so it forces them to all be rebuilt typicay you only have one target up at the top which doesn t really compile anything depends on all of the 0 files if any of them have changed then it relinks them into a single hello file CATc example include ltstdiohgt int copyFilechar fileName FILE in intch in fopenfileName quotrquot if in return 1 while ch fgetcin EOF putcharch fclosein int mainint argc char argv int iarg for iarg 1 iarg lt argc iarg copyFileargviarg return 0 SCANFPRINTFDEMOc example include ltstdiohgt int main char fname20 char lname20 int age printfquotEnter lastname firstname prints out to prompt user scanfquot os osquot lname fname reads from input printfquotEnter age scanfquot odquot ampage printfquotEntered Name 3 osnquot fname Iname printfquotEntered Age o15dnquot age return 0 Stringsc example include ltstdiohgt include ltstringhgt int mainint argc char argv char str1 quotHelloquot char str2 quotGoodbyequot char str14 strcpystr str1 strcatstr str2 printfquot os s osnquot str1 str2 str printfquotThe length of s is odnquot str strlenstr char s1 quotabcquot char 2 quotabdquot int tmp strcmps1 32 if tmp lt O printfquot os lt osnquot s1 32 else if tmp gt O printfquot os gt osnquot s1 32 else printfquot os osnquot s1 32 char s quotThis is a testquot char token strtoks quot quot while token NULL printfquot osnquot token token strtokNULL quot quot Structc example include ltstdiohgt include ltstdibhgt include ltstringhgt define NSTUDENTS 5 struct person char name15 char email6 int age p quotJim Smithquot quotab0123quot 29 struct person q int mainint argc char argv struct person p2 mallocsizeofstruct person strcpyp2 gtname quotSue Jonesquot strcpyp2 gtemail quot123abcquot p2 gtage 25 printfquot os os odnquot pname pemai page printfquot os os odnquot p2 gtname p2 gtemail p2 gtage freep2 return 0 Union union Data int i unsigned int ui short si unsigned short us struct bytes bb float f char str20 stack 100 Difference between struct and Union in a struct each of the fields are laid out one after another A union works like a struct except that all of the fields at offset 0 All start at the beginning of the struct Al overlapping in memory Occupying same initial bytes You can use a union when you want two different fields to occupy the same bytes in memory virtual machine can be a memory saving device can be used for fiddling with the individual bits or bytes of an individual data type C Language Extension on files is now cc include ltiostreamgt hello world demo using namespace std NAMESPACES gt like java packages assigning a piece of code to a namespace always include this int mainint argc char argv int X 5 cout ltlt Hello ltlt World ltlt x ltlt endl output stream cerr ltlt Oh no I made a mistaken for int i0 ilt argc i cout ltlt arg ltlt i ltlt ltlt argvi ltlt endl return 0 ltlt inserts things into output stream endl gt end of line character the n changing compilers g filename Strings 2 kinds of strings string s1 ABC gt string literal if you want to use C library include ltcstringgt and also add include ltstringgt gt for c strings find gt find things in strings and gives index of beginning part of what you want to find size and length are same thing s1at1 gt character at index of 1 start at O s11 gt same thing as at1 s1 GHI gt appends it onto the string s1substr32 s1operatorlts3 gt compares 2 strings 1 true Ofalse output of file demo ABCDEF 6 6 size and length are B at B 1 ABCDEFGHI 3 find DEF DE substring 32 getting exactly 2 characters starting at 3 O s1empty 1 s2empty Classes include filename gt surrounded by double quotes if it is local file gt referring to the file directly every class will have 2 files one ends in h contains def of class itself need to include every time we use that class elsewhere one ends in cc ifndef STACKH gt gets executed at the preprocessor level if the following symbol is not defined if it is ignored it will skip everything else not methods gt member functions Streams cout ostream coutltlt Hello ltlt endl cin istream cin gtgt x gtgt y If you make things a reference then you don t have to copy it Destructor acts as garbage collector that will release dynamically allocated memory get gt reads in new character VALUES OF CHARACTERS newline character value is 10 carriage return is 13 tab is 9 form feed is 12 Reference vs Pointer NEED TO KNOW Example Pass by Value intx5 void fcnint n fcnx Copies value of x into variable n gt PASS BY VALUE Example PASS BY REFERENCE does not exist in Java intx5 void fcn2intamp n fcn2x only change is parameter is now intamp now x and n are now pointing to the same location in memory aliases for each other passing a referencepointer to x Consequences No longer copying the value of x really more of an issue with objects such as istream nside the function if n is set to a value 1st example would still return 5 but in the second example it would return 10 bc n and x are pointing to the same location Example intx5 void fcn3int n fcn3ampx in this case the parameter isn t an int it is a POINTER to an int gt essentially an address that points to an int can t directly pass x to the function fcn3 if we did pass x compiler error expects pointer to int but getting int if you put the amp that is the pointer to operator takes a pointer to the variable with it in this case x inside the function if n5 write out the value of n you would get just added 5 to the pointer of x n is not an integer it is a pointer if you add to n add 5 to this pointer which means it doesn t know where it is pointing anymore if you wanted to add 7 correctly to initial value 5 make the function n 7 n is an int now bc it is dereferencing n Can make new objects without the new operator in C unlike Java EBNF Parsing Extended Backus Naur Form nonterminals variables gt corresponds to a noun verb adjective subject predicate in English grammar A word that represents a certain structure within the grammar tokens terminal gt the stuff thats printed out ltprogramgt nonterminal PROGRAM gt token ltprogramgt PROGRAM lDENT ltcompoundstatementgt END PROGRAM ltcompoundstatementgt ltstatementgt ltstatementgt curly bracket represents the fact that the thing inside can be repeated 0 or more times ltstatementgt ltsetstatementgt ltprintstatementgt ltwhiestatementgt ltiistatementgt ltiorstatementgt ltsetstatementgt SET IDENT ASSIGN ltexpressiongt Represents a RuleProduction vertical bars mean OR means that the thing inside is optional ex Ii statement ltiistatementgt IF ltogicaexpressiongt THEN ltcompoundstatementgt ELSE ltcompoundstatementgt ENDIF Assembly code gt set of instructions for some sort of machine GRAMMAR ltprogramgt PROGRAM lDENT ltcompoundstatementgt END PROGRAM ltcompoundstatementgt ltstatementgt ltstatementgt ltstatementgt ltsetstatementgt ltprintstatementgt ltwhiestatementgt ltiistatementgt ltiorstatementgt ltsetstatementgt SET IDENT ASSIGN ltexpressiongt ltprintstatementgt PRINT ltprintExpressiongt COMMA ltprintExpressiongt ltprintExpressiongt ltexpressiongt STRLlT ltwhiestatementgt WHILE ltogicaexpressiongt DO ltcompoundstatementgt END ltifstatementgt IF ltogicaexpressiongt THEN ltcompoundstatementgt ELSE ltcompoundstatementgt ENDIF ltforstatementgt FOR IDENT ASSIGN ltexpressiongt TO ltexpressiongt ltcompoundstatementgt END ltogicaexpressiongt ltrelationalexpressiongt AND ltrelationalexpressiongt OR ltrelationalexpressiongt ltrelationalexpressiongt ltexpressiongt EQ ltexpressiongt l LT ltexpressiongt l LE ltexpressiongt GT ltexpressiongt l GE ltexpressiongt NE ltexpressiongt ltexpressiongt lttermgt PLUS lttermgt l MINUS lttermgt lttermgt ltfactorgt TIMES ltfactorgt l DIVIDE ltfactorgt l REM ltfactorgt ltfactorgt LPAREN ltexpressiongt RPAREN INTLIT FLOATLIT IDENT SVM Stack oriented machine CA1 LOADV A gt gets A and puts on stack LOADL1 gt load literal for constants loads 1 on stack ADD gt pops two top values off stack and adds them and pushes it back on stack STOREV C gt value of A 1 is sitting on stack pops top value off stack and stores it in variable C DIV gt integer division JUMP gt does an unconditional jump to the given label PRINT gt prints top value and writes it out PRINTS gt takes a string and writes it out DUP gt pushes another copy of the value on the top of the stack ISGT gt pops top two values on stack and returns 0 or 1 checking comparison


Buy Material

Are you sure you want to buy this material for

50 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.