×

### Let's log you in.

or

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

×

or

## PROGRAMMING CONCEPTS

by: Pattie Harvey

23

0

35

# PROGRAMMING CONCEPTS CSCI 261

Pattie Harvey
GPA 3.59

Keith Hellman

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

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

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

×
Unlock Preview

COURSE
PROF.
Keith Hellman
TYPE
Class Notes
PAGES
35
WORDS
KARMA
25 ?

## Popular in ComputerScienence

This 35 page Class Notes was uploaded by Pattie Harvey on Monday October 5, 2015. The Class Notes belongs to CSCI 261 at Colorado School of Mines taught by Keith Hellman in Fall. Since its upload, it has received 23 views. For similar materials see /class/219628/csci-261-colorado-school-of-mines in ComputerScienence at Colorado School of Mines.

×

## Reviews for PROGRAMMING CONCEPTS

×

×

### What is Karma?

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

Date Created: 10/05/15
EXAM I REVIEW August 5 2009 Identify each term that is a valid C identi er or explain Why it is not A oxygen B TheHotTomatoes C double D 2TooMar1y E Ozone A What two pieces of information are needed for any variable declaration B What third piece of information may be provided Consider the snippet of code at the 1 double X 34 tight What are the values of X y and 2 double y 34 z after the variables have been 3 double Z 304 initialized Write the English statement as a C Boolean expression a test condition that might be used in an if or while statement A The real value x is between 15 exclusive and 2 inclusive B The integer z is greater than zero and divides the integer y evenly C m is less than zero or m is greater than or equal to 4 What type of looping control structure should be used if a sequence of statements must execute for a predetermined number of times l I What does the following snippet print to the screen 1mclude lt1ostreamgt 2 usmg namespace mt mam vord gt std mtxlt346 1fx lt4 gt cout ltlt TreatgyouxgpasswodellkeHyouIHtoothbxush ltlt endl gt lse sthch x gt Case 5 cout ltlt case 7 brea default return 0 COUL ltlt Cout ltlt break Don tuletuanybodyuelseuuseult ltlt endl H anngetHaHnewHone H ltlt endl evexstlemonths H ltlt endl H nucllffoxdustoll H ltlt endl Rewrite the code snippet attheright 2int counter 3 usingaforloop 311 valueuo Declare the counter 4 While counter gt 0 variable such thatitvs 5 value Value 7counter lifetime and scope is 6 limited to the for loop l I Examine the code snippet at the right for mtm1 mlt3mt cout ltlt Hr for mt Jmil1gt0 1397 W39y cout ltlt endl 1 Z 3 A In total how many characters 5 will be printed B How many characters will be printed on the rst iteration of the outermost loop ml C How many characters will be printed on the last iteration of the outermost for loop D How many complete lines will be displayed to the user EXAM 11 REVIEW August 5 2009 l I Write a C statement that declares an array of 4 Boolean values l I Write a C statement that declares an array of 4 Boolean values Now do it another way l I Write a C statement that declares an array of 4 Boolean values Now do it another way Write a C statement that declares an array of 14 doubles initialized to zero l I Write a C statement that declares an array of 4 Boolean values Now do it another way Write a C statement that declares an array of 14 doubles initialized to zero Can you write a C statement of 1000000 Boolean values initialized to true Write a snippet of C that declares an array of 1000000 Boolean values and initializes them to true l I True or False Arrays are always passed by value in function parameters l I True or False Arrays are always passed by value in function parameters Suppose that double findMaxValue const double data const int elements is available to your main routine that has an array of doubles declared as double myDataSIZE How do you nd the maximum value of myData l I 2d Arrays A sudoku grid has 9 rows 9 columns and 9 quotquadsquot each with a number from 1 to 9 A valid sudoku grid does not have any repeated numbers in a row column or quad Sudoku Puzzle N0 07122829722321 l I 2d Arrays Two rows of a valid sudoku grid may be swaped resulting in another valid sudoku grid as long as the two rows are in the rst middle or last row of quads You can swap rows 48953 and 653l7 but you cannot swap 48953 and l7692 Sudoku Puzzle No 07122829722321 l I 2d Arrays Write a function de nition for rowaap that accepts 1 A Zd array of integers named puzzle with 9 rows and 9 columns 2 Row offsets a and b rowaap should be a void function and you guessed it swap rows a and b Sudoku Puzzle No 07122829722321 Write the C prototype for the functions described below in all cases let the function name be Function A A function without arguments that does not return a value 13 A function without arguments that returns a double C A function returning an integer value whose arguments are in this order an integer named foo a character named bar and a string named foobar The integer argument is passed by reference the other arguments are passed by value l I Consider the C source to the right 11 void x1ghttoleft mt left 1ntamp right 12 13 left gm 14 15 A What are the values ofx y and z 15 ma leftJoJlghtl 1m 1m 1ntamp gm 1 1 after llne 36 has n1shed 18 right left 39 7 19 executlng 20 21 Void incrementl 1mgz 1m 1m tight B What are the values of x y and z 22 after line 37 has nished 9 1quot 11ghtleft executing 25 25 27 d d 31 l f h C What are the values ofx y and z 28 ec emem e L 1 g t after line 38 has nished executing 31 U 32 What are the values ofx y and Z voxd helterskelter ma 1 after line 39 has nished 35 mt xlU ym 22 executing 35 rementt x y 37 38 39 40 Consider the declaration for Data w tgwwmmmAWNN 14 1 wwwmm Include lt uslng name class Data publicr Data p10 iostxeamgt space std ostxeamamp output ostxeamamp getX const processidata const Dataamp e double setAY double newa 1m cessidata Vold Data processidata 1n newx double a bC Y 05 const is datum const newy const nt newy intamp oldy gt How many public data members does this class declare WNwawwmAWN 14 1 wwwmm Consider the declaration for Data include ltiost1eamgt using namespace std class Data public ostxeamamp output ostxeamamp os const is m Data processidata const Dataamp datum const e double setAY double newa nt newy intamp oldy Data processidata Vold const Data processidata nt newx nt newy double a b c w gt Which member functions might change the state of the calling object WNwawwmAWN 14 1 wwwmm Consider the declaration for Data include ltiost1eamgt using namespace std class Data public ostxeamamp output ostxeamamp os const is m Data processidata const Dataamp datum const e double setAY double newa nt newy 1ntamp oldy Data processidata Vold const Data processidata nt newx nt newy double a b c w gt Which member functions would be considered assessor functions WNwawmmAWN 14 1 wwwmm Consider the declaration for Data include ltiost1eamgt using namespace std class Data public ostxeamamp output ostxeamamp os const is m Data processidata const Dataamp datum const e double setAY double newa nt newy intamp oldy Data processidata Vold const Data processidata nt newx nt newy double a b c w gt What is unconventional with the prototype on line 11 l I Consider the declaration for Data 1 include ltiost1eamgt 2 using namespace std 3 4 class Data 5 public 5 ostxeaum output ostxeaum os const 7 istleallm 1nput istleallm S 8 Vold setE double ne 939 int et nt 117 double getAo const 11 double get 12 double 0 const 13 Data processidata const Dataamp datum const 14 private 15 ouble setAY double newa int newy mm oldy 15 Data processidata Vold const 17 Data processidata nt newx int newy 18 double a b c 19 int x y 217 gt Which would be valid C constructor prototypes void Data Data int x Data void const Data Data void I WNwawmmAWN 14 1 wwwmm Consider the declaration for Data include ltiost1eamgt using namespace std class Data public ostxeamamp output ostxeamamp os const is m Data processidata const Dataamp datum const e double setAY double newa nt newy intamp oldy Data processidata Vold const Data processidata nt newx nt newy double a b c w gt Write the prototype for Data39s default constructor Consider the declaration for Data WNwawmmAWN 14 15 w include ltiost1eamgt using namespace std class Data public ost eamamp output ostxeamamp os const is 1 1eamamp 1nput istleamamp e double 9 double const Data processidata const Dataamp datum const pllvate double setAY double newa nt newy intamp oldy Data processidata Vold const Data processidata nt newx nt newy double a b c 1mxw gt Write the de nition what would be written in Datacpp of the default constructor All data members should be initialized to a value of 0 Can you do this without C statements in the function body Consider a partial implementation for Data Data Datapxocess7data const Dataamp datum const Data newidata z b datumx 2 newidataa datumc y 3 4 5 5 7 newidatab 8 9 0 xetuxn newidata 1 Describe What each part of line 3 means gt The rst Data Consider a partial implementation for Data Data Datapxocess7data const Dataamp datum const Data newidata z b datumx 2 newidataa datumc y 3 4 5 5 7 newidatab 8 9 0 xetuxn newidata 1 Describe What each part of line 3 means gt The rst Data gt The second Data Consider a partial implementation for Data Data Datapxocess7data const Dataamp datum const Data newidata z b datumx 2 newidataa datumc y 3 4 5 5 7 newidatab 8 9 0 xetuxn newidata 1 Describe What each part of line 3 means gt The rst Data gt The second Data gt The third Data Consider a partial implementation for Data Data Datapxocess7data const Dataamp datum const Data newidata z b datumx 2 t c y newidataa datum 3 4 5 5 7 newidatab 8 9 0 xetuxn newidata 1 Describe What each part of line 3 means gt The rst Data gt The second Data gt The third Data gt The rst const Consider a partial implementation for Data Data Datapxocess7data const Dataamp datum const Data newidata b datum x 2 datumc y newidataa 3 4 5 5 7 newidatab 8 9 0 xetuxn newidata 1 Describe What each part of line 3 means gt The rst Data gt The second Data gt The third Data gt The rst const gt The last const

×

×

### BOOM! Enjoy Your Free Notes!

×

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

Allison Fischer University of Alabama

#### "I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over \$600 per month. I LOVE StudySoup!"

Jim McGreen Ohio University

Forbes

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

#### STUDYSOUP CANCELLATION 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 support@studysoup.com

#### STUDYSOUP REFUND POLICY

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: support@studysoup.com

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 support@studysoup.com