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


by: Darrion Bednar

IntroductiontoComputerScienceII CISC181

Darrion Bednar
GPA 3.73


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

Class Notes
25 ?




Popular in Course

Popular in Computer Information Technology

This 8 page Class Notes was uploaded by Darrion Bednar on Saturday September 19, 2015. The Class Notes belongs to CISC181 at University of Delaware taught by Staff in Fall. Since its upload, it has received 47 views. For similar materials see /class/207174/cisc181-university-of-delaware in Computer Information Technology at University of Delaware.

Popular in Computer Information Technology


Reviews for IntroductiontoComputerScienceII


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/19/15
ZOOQ S CISC 181 01X Nate 7 Yau shbuld be able t0 find the answers t0 these Practice Mid Term A questibns in the Lectures Text 0r Labs 100 Points total If yau are in daubt after making an hanest e brt email me with the questibn in questibn 2 PTS NAME DATE SECTION Advice brie y review the questions amp determine if there are any confusing requirements then answer the questions in the order that makes the most sense to you If something looks like a mistake raise your hand right away don t shout out no right answers to problem 5 When I provide code fragments assume that everything else includes namespace etc is correct In cases where more than one answer is true choose the best answer among the choices Q 01 10 points Answer TrueFalse for the following questions a A C compiler interprets lines of code one at a time as they are executed F b An assembler converts machine language to C or C F c A given struct can hold only one primitive data type F d C functions must directly mention themselves to be recursive F e constantampsorrow is a valid C identifier F 1 C allows function invocations to precede function declarations F g bool floatVal declares a oating point number F h Compiled C programs are guaranteed to produce the same result for every CPU and operating system F i Only b and f are correct F Q 02 4 points Choose the best answer The example of Java virtual machine code shown in the lecture was written mostly in a Java b Commonlisp c OCAML d C e Fortran f C Q 03 4 points putting include ltiostreamgt at the top of a C file does the following a Appeases the idols on Strauss 7 so they will go break someone else s program b Tells the compiler you want to use the programmers namespace c Causes the compiler to output assembly language in a stream rather than a block d Allows you to include the standard math library e Virtually adds thousands of lines of declarations to your code IZI I Gives you access to the standard C library Q 04 4 points What will the following code fragment print given that int X 3 if x ampamp x 0 ampamp 0 cout ltlt quotOKquot ltlt endl else cout ltlt quotNot OKquot ltlt endl OK b Not OK IZI c Nothing 7 taking the address of O crashes the program Page 1 of 6 Points Lost this page QOS 4 points You may find this useful in later questions Fill in the missing binary values for the following table QO6 9 points What will the following code fragments print intx3 inty39 39t 39 a cout ltlt x y ltlt endl 7 b cout ltlt 3 y 55 x a y ltlt endl 0 c cout ltlt false II x ampamp z amp 2 35355le H Y 44ltltend1 Y xgty33 44 QO7 4 points In order to use cout ltlt in a C program without using the scope operator the programmer must a b c d e f g Provide a gtgt cin to balance it Redirect the output to standardamppoors Nothing 7 it just works like magic Include the line include ltiostreamgt Include the line using namespace st a and d d and e M QOS 6 points Given 3 functions int Page 2 of 6 fint fint gint hint x int gint x int hint x x 2 hx 1 ght2 x return xlt 1 x x return x lt 0 f x x return x lt 1 fx f g and h are all recursive not one of f g and h is recursive f and g are recursive but h is not f and h are recursive but g is not g0 and h are recursive but f is not IZI they are all illegal functions in C Points Lost this page Q09 5 points Which of the following problems does the C namespace approach solve a making the language easier to learn b preventing modification of global variables c preventing corruption of local variables d preventing quotcollisionsquot where the same identifier is used in different ways by different modules M e preventing quotsubversionsquot where last include file read removes all previous identifiers Q10 5 points A for statement which has no initialization test or update eXpression a will never terminate b can be terminated by a quotcontinuequot statement c will not be evaluated d can be terminated by a brea or a goto statement IZI e loops just once then stops because of the implicit test Qll 5 points short int x 0 for cout ltlt quotx quot ltlt x ltlt endl Which choice best describes the result of executing this code a The code will print exactly 32768 lines of output b The second line printed will be X 1 M c The last X printed will be 32767 d The first line printed will be X 1 e This code will break because the braces are on the same line as the for Q12 5 points Part A Define a struct named stats that holds an integer named count a double named ave and a double named sd struct stats int count double ave Part B Define a struct named player that holds a character array of size 20 named name and a stats struct named personalStats struct player char name20 stats personalStats Page 3 of 6 Points Lost this page Q13 6 points Consider the code fragments int donna int input bool reset false static int summer 0 if reset summer 0 else summer input return summer H forint i 0 i lt 7 i donna i if4 i donna999 true cerr ltlt quotdonna0gt quot ltlt donna0 ltlt endl When executed this code will 39 a segfault 7 because we called donna with too few arguments b print donna0gt 11 c print donna0gt 1020 d print donna0gt 21 e print donna0gt 0 1 print donnadonnadonna until you run out of paper Q14 6 points Fill in the missing line or lines of the following shuf e function The function is intended to give every element of ar an opportunity to be swapped with some randomly chosen element of the same array Add no more than 43 characters void shuff1eint ar int arLen orint i O i lt arLen i int tmp ari to rand arLen ari arto what goes here arto tmp what goes here Q15 6 points Write a function displayRowint row int len Which displays a character for each integer in row If the integer is gt 0 display C if it is lt 0 display N Do not use an if statement or a switch statement in this function 3 pts if you do so void displayRowint row int len for int i 0 i lt len i cout ltlt rowi gt 0 C N cout ltlt endl Page 4 of 6 Points Lost this page Q16 5 points Yossarian a neophyte programmer has made two mistakes in the following code Correct them by changing no more than 13 characters void doubincrdoubleamp value double increment side effect increments value by increment value increment double val 15 fordouble i 01 i lt 05 i 01 increment val with successive doubles of i doubincrval ampi crossed out the amp cerr ltlt quotval quot ltlt val ltlt endl Q17 3 points What does the above code print out assuming you fixed it correctly a 75 b 75 c 33333333 d 15 e 25 IZI f 35 Q18 5 Points Part A Write two functions both called average that compute and return the average of an array One function acts on an array of doubles the second acts on an array of ints double averagedoub1e ar int arLen note assumes arLen gt0 double ave 0 forint i 0 i lt arLen i ave ari return ave double arLen cast isn t necessary just for your benefit double averageint ar int arLen note assumes arLen gt0 double ave 0 note the average is still a double forint i 0 i lt arLen i ave double ari again don t need the cast return ave double arLen again don t need the cast Part B What are the sequence and identity of the function arguments called It signature Part C What allows us to use the same two names in the same program function overloading Page 5 of 6 Points Lost this page Note I may substitute one question on scoping for one of the existing questions Note An extra Credit question is usually offered for folks who get bored during the test Page 6 0f 6 Points Lost this page CISC 1 8 1440 Review for Exam 1 Disclaimer while this list SHOULD cover everything itMAY not Don39t argue after the final ifthere happens to be something on the final that wasn39t mentioned in this list Topics 119125 21 221 3138310320 41464849 512 6264 Sort history of C where did it come from why it s different than C Compiling in C preprocessingcompilinglinking Preprocessor directives What is an algorithm Type Casting Promotion versus Truncation Preincrement vs Post Incremenet Looping WhileDo WhileFor Sentinal vs Counter Controller Know how to write loops Sequential Access Files using ifstreamofstream How to open and write to an ofstream how to open and read from an ifstream Random Numbers Pseudo random numbers how to seed Scaling numbers Signed vs Unsigned Numbers Storage Classes autostaticeXternregister Scope Rules Recursion Solve Base call call itself with simpler case why it s goodbad Inline Functions References Difference between Call by Value and Call by Reference Default Arguments Unary Scope Resolution Operator Function Overloading Arrays DeclaringInitializing Multi Dimension Arrays Passing Arrays to Functions Order NotationRunning times Functions Function De nitionPrototypes Bubble Sort Insertion Sort Linear Search Binary Search Structures CISC 1 8 1440 Review for Exam 2 Disclaimer while this list SHOULD cover everything itMAY not Don39t argue after the final ifthere happens to be something on the final that wasn39t mentioned in this list Topics 41 7 410 5158 512 76 171174 Linked List Tutorial on Web page Your notes you do have notes don39t you and my slides 811 What an array is how they work C Style Strings C Style Strings Differences between the two Know how to use copy and compare CStyle strings Pointers what are they creatingassigning Pointers the Null Pointer The address of amp operator The dereferencing operator Function passing using pointers Const Pointers 3 types Pointer Arithmetic Pointer Offset vs Pointer Subscript notation Static vs Dynamic Memory Allocation new and delete Allocating structs on the heap the gt operator Linked Lists How their de ned created Attaching nodes Searching Linked lists Losing NodesMemory Leaks Using an iteratordealing with empty lists


Buy Material

Are you sure you want to buy this material for

25 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

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!"

Kyle Maynard Purdue

"When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the I made $280 on my first study guide!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."


"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.