1 Page

Exam2_Review_Key.4

Course: CSCE 121, Fall 2009
School: Texas A&M
Rating:
 
 
 
 
 

Word Count: 203

Document Preview

121 Exam CPSC 2 Review Key d. declare a new name for an existing variable e. None of the above Short answer 19. What is wrong with this code fragment? try { //some code goes here } catch() { cerr << Exception!\n; keep_window_open(); return 1; } catch(const logic_error& e) { cerr << Logic error: << e.what() << \n; keep_window_open(); return 2; } The...

Register Now

Unformatted Document Excerpt

Coursehero >> Texas >> Texas A&M >> CSCE 121

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
121 Exam CPSC 2 Review Key d. declare a new name for an existing variable e. None of the above Short answer 19. What is wrong with this code fragment? try { //some code goes here } catch() { cerr << Exception!\n; keep_window_open(); return 1; } catch(const logic_error& e) { cerr << Logic error: << e.what() << \n; keep_window_open(); return 2; } The catch all exceptions catch has been placed before the catch specific exceptions catch. All exceptions will be caught by the and none by the logic_error, which defeats the purpose of it being there. The logic_error catch should be placed first. 20. Write a function (call it swapie( )) that two takes doubles as arguments and swaps their values; i.e., if x == 14 and y == 7 before you call swapie( ), then after you call swapie( ) x == 7 and y == 14. void swapie( double& a, double& b) { double temp; temp = a; a = b; b = temp; } 21. Given the partial code below, add lines of code to complete the square. Polygon p; //closed shape p.add(200, 200); p.add(200, 300); p.add(300, 300); p.add(300, 200); 22. It is sometimes said that a programmer is someone who cannot tell the difference between Halloween and Christmas, so what is the output of the following? cout << oct << 031 << \n; cout << dec << 25 << \n; 31 25
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Texas A&M - CSCE - 121
CPSC 121Exam 2 Review Key23. Explain in detail what cin.unget( ) (or putback) does, since it cant literally put a character back into thekeyboard by popping out the last key pressed.The last character read from cin is placed back into the input buffer
Texas A&M - CSCE - 121
CPSC 121Exam 2 Review Key30. The following C+ code fragment wont compile because of scoping problems. Rewrite it correctly.Note: Dont worry about the infinite loop, just get it to compile.void f() cfw_g();void g() cfw_f();void h() cfw_int x = y
Texas A&M - CSCE - 121
Chapters 1 &amp; 2ChaptersProgramming and ProgramsBjarne StroustrupBjarnewww.stroustrup.com/Programmingwww.stroustrup.com/ProgrammingAbstractToday, well outline the aims for this course andToday,present a rough course plan. Well introducethe basic
Texas A&M - CSCE - 121
Chapter 3ChapterObjects, types, and valuesBjarne StroustrupBjarnewww.stroustrup.com/Programmingwww.stroustrup.com/ProgrammingAbstractAbstractMost programming tasks involve manipulating data.MostToday, we will:Today,describe how to input and o
Texas A&M - CSCE - 121
Chapter 4ChapterComputationBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractToday, Ill present the basics of computation. InToday,particular, well discuss expressions, how toiterate over a series of values (iteration), andselect between tw
Texas A&M - CSCE - 121
Chapter 5ChapterErrorsBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractWhen we program, we have to deal withWhenerrors. Our most basic aim is correctness, butwe must deal with incomplete problemspecifications, incomplete programs,
Texas A&M - CSCE - 121
Chapter 6ChapterWriting a ProgramBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis lecture and the next describe the processThisof designing a program through the example ofa simple desk calculator.simpleStroustrup/Programmin
Texas A&M - CSCE - 121
Chapter 7ChapterCompleting a ProgramBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractTokens and token streamsStructs and classesCleaning up the codePromptsProgram organizationconstantsRecovering from errorsCommentingCode revie
Texas A&M - CSCE - 121
Chapter 8ChapterTechnicalities: Functions, etc.Bjarne StroustrupBjarnewww.stroustrup.com/Programmingwww.stroustrup.com/ProgrammingAbstractAbstractThis lecture and the following present some technicalThisdetails of the language to give a slightl
Texas A&M - CSCE - 121
Chapter 9ChapterTechnicalities: Classes, etc.Bjarne Stroustrupwww.stroustrup.com/ProgrammingCambridgeCambridgeStroustrup/Programming2ISO C+ standards committeeISOStroustrup/Programming3CERNCERNStroustrup/Programming4AbstractAbstractThis
Texas A&M - CSCE - 121
Chapter 10ChapterInput/Output StreamsBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractWe get data from files, sensors, webWeconnections, etc., which we want toanalyze, print, graph, etc. Sometimes, wewant to produce such data. In
Texas A&M - CSCE - 121
Chapter 11ChapterCustomizing I/OBjarne Stroustrupwww.stroustup.com/ProgrammingOverviewOverviewInput and outputNumeric outputFile modesIntegerFloating pointBinary I/OPositioningString streamsLine-oriented inputCharacter inputCharacter clas
Texas A&M - CSCE - 121
Chapter 12ChapterA display modelBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis lecture presents a display model (theThisoutput part of a GUI), giving examples of useand fundamental notions such as screencoordinates, lines,
Texas A&M - CSCE - 121
Chapter 13ChapterGraphics classesBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractChapter 12 demonstrates how to create simple windows andChapterdisplay basic shapes: square, circle, triangle, and ellipse; Itshowed how to manipulat
Texas A&M - CSCE - 121
Chapter 14ChapterGraph class designBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractWe have discussed classes in previous lecturesHere, we discuss design of classesLibrary design considerationsClass hierarchies (object-oriented pro
Texas A&M - CSCE - 121
Chapter 15ChapterFunctions and graphingBjarne StroustrupBjarnewww.stroustrup.com/Programmingwww.stroustrup.com/ProgrammingAbstractAbstractHere we present ways of graphing functionsHereand data and some of the programmingtechniques needed to do
Texas A&M - CSCE - 121
Chapter 16ChapterGraphical User InterfacesBjarne Stroustrupwww.stroustrup.com/ProgrammingOverviewOverviewPerspectiveI/O alternativesGUILayers of softwareGUI exampleGUI codecallbacksStroustrup/Programming2I/O alternativesI/OUse console in
Texas A&M - CSCE - 121
Chapter 17Chaptervector and Free StoreBjarne StroustrupBjarnewww.stroustrup.com/Programmingwww.stroustrup.com/ProgrammingAbstractAbstractVector is not just the most useful standard container,Vectorit is also provides examples of some of the mos
Texas A&M - CSCE - 121
Chapter 18ChapterVectors and ArraysBjarne StroustrupBjarnewww.stroustrup.com/Programmingwww.stroustrup.com/ProgrammingAbstractAbstractarrays, pointers, copy semantics, elementsarrays,access, referencesaccess,Next lecture: parameterization of
Texas A&M - CSCE - 121
Chapter 19ChapterVectors, templates, and exceptionsBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis is the third of the lectures exploring theThisdesign of the standard library vector and thetechniques and language features us
Texas A&M - CSCE - 121
Chapter 20The STLThe(containers, iterators, and algorithms)Bjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis lecture and the next present the STL theThiscontainers and algorithms part of the C+ standardlibrarylibraryThe STL
Texas A&M - CSCE - 121
Chapter 21ChapterThe STL(maps and algorithms)Bjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis talk presents the idea of STL algorithms andThisintroduces map as an example of a container.introducesStroustrup/Programming2Ove
Texas A&M - CSCE - 121
Software ideals and historySoftwareBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis is a very brief and very selective history ofThissoftware as it relates to programming, and especiallyas it relates to programming languages an
Texas A&M - CSCE - 121
Chapter 23ChapterText ProcessingBjarne Stroustrupwww.stroustrup.com/ProgrammingStroustrup/Programming1OverviewOverviewApplication domainsStringsI/OMapsRegular expressionsStroustrup/Programming2Now you know the basicsNowReally! Congratula
Texas A&M - CSCE - 121
Chapter 24ChapterNumericsBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis lecture is an overview of the fundamentalThistools and techniques for numeric computation.For some, numerics are everything. For many,numerics are occa
Texas A&M - CSCE - 121
Chapter 25ChapterEmbedded systems programmingBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis lecture provides a brief overview of whatThisdistinguishes embedded systems programmingfrom ordinary programming. It then touchesup
Texas A&M - CSCE - 121
Chapter 26ChapterTestingBjarne Stroustrupwww.stroustrup.com/ProgrammingAbstractAbstractThis lecture is an introduction to the design andThistesting of program units (such as functions andclasses) for correctness. We discuss the use ofinterfaces
Texas A&M - CSCE - 121
Chapter 27ChapterThe C Programming LanguageBjarne Stroustrupwww.stroustrup.com/ProgrammingDennis M. RitchieAbstractAbstractThis lecture gives you the briefest introduction to CThisfrom a C+ point of view. If you need to use thislanguage, read a
Texas A&M - CSCE - 121
Ch 1 2 Programming and &quot;Hello, World!&quot;Ch 3 Objects, Types, and ValuesCh 4 ComputationCh 5 ErrorsCh 6 Writing a programCh 7 Completing a programCh 8 Technicalities: Functions, etc.Ch 9 Technicalities: Classes, etc.Ch 10 Input/Output StreamsCh 11 C
Texas A&M - CHEM - 101
EXAM ISample Exam 1-1Dr. V. WilliamsonFORM D is EXAM I, VERSION 1 (v1)1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.These tests are machine graded; therefore, be sure to use a No. 1 or 2 pencilfor m
Texas A&M - CHEM - 101
EXAM ISample Exam 1-1Dr. V. Williamson1. What is the % by weight (mass percent) of Cl in CH2Cl2?A. 16.5B. 83.5C. 41.8D. 19.8E. 94.12. Which of the following transitions in the Bohr hydrogen atommodel gives an emission of the shortest wavelength?
Texas A&M - CHEM - 101
EXAM ISample Exam 1-1Dr. V. Williamson8. Which of the following are FALSE in whole or in Part?I.According to Dalton, who was the first person to describeatoms, atoms are only rearranged in chemical reactions.II. According to Bohr, the electrons mov
Texas A&M - CHEM - 101
EXAM ISample Exam 1-1Dr. V. Williamson15. Mark each of the following as true or false. Which of thefollowing is FALSE?A.B.C.D.E.A row could also be called a period.Column U contains mostly metalsColumn S is the alkali metals.Column Y is the h
Texas A&M - CHEM - 101
EXAM ISample Exam 1-156789101112131415161718Dr. V. WilliamsonACEB (A,D,E=3pts)A (B=3pts)EDACDCA (D=3pts)A6.5 ptsA Vickie M. Williamson 2007, All Rights Reserved4
Texas A&M - CHEM - 101
EXAM ISample Exam 1-2Dr. V. WilliamsonFORM A is EXAM I, VERSION 2 (v2)1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.These tests are machine graded; therefore, be sure to use a No. 1 or 2 pencilfor m
Texas A&M - CHEM - 101
EXAM ISample Exam 1-2Dr. V. Williamson1. Calculate the formula weight (molar mass) of (NH4)2S406.A. 356B. 242C. 260D. 288E. 632. How many grams of oxygen atoms are in 65 g of C2H2O2A. 22B. 36C. 11D. 18E. 723. The ionization energy is higher
Texas A&M - CHEM - 101
EXAM ISample Exam 1-2Dr. V. Williamson9. How many significant figures should there be in the answer tothe following problem?A.2(29.2 20.0) (1.79 x 105)1.39B.3C.1D.5E.410. Which of the following is (are) FALSE?I. Dalton was NOT the first perso
Texas A&M - CHEM - 101
EXAM ISample Exam 1-2Dr. V. Williamson15. What is the Fahrenheit temperature that corresponds to 0 K?A. 549FB. 523FC. 434FD. 459FE. 120F16. A compound containing only carbon, hydrogen, and oxygen isanalyzed and found to be 70.6% carbon, 5.9% hyd
Texas A&M - CHEM - 101
EXAM II1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.Sample Exam 2-1Dr. V. WilliamsonFORM is EXAM II VERSION 1 (v1)DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.These tests are machine graded; therefore, be sure to use a No. 1 or 2 pencil forma
Texas A&M - CHEM - 101
EXAM IISample Exam 2-1Dr. V. Williamson1. Calculate the percent yield if 0.75 mol of calcium metal is treated with excess HCl and yields1.4 g of hydrogen gas in the laboratory.The UNBALANCED reaction equation is: Ca + HCl H2 + CaC12Atomic Molar Mass
Texas A&M - CHEM - 101
EXAM IISample Exam 2-1Dr. V. Williamson6. Which statement about the following reaction is INCORRECT?Zn(s) + 2HI(aq) ZnI2(aq) + H2(g)A. The oxidation number of the Zn ion in ZnI2 is 2+.B. The H in HI is the reducing agent.C. The oxidation number of
Texas A&M - CHEM - 101
EXAM IISample Exam 2-1Dr. V. Williamson11. How many grams of CH3OH would have to be added to water to prepare 150 mL of asolution that is 2.0 M CH3OH?Atomic Molar MassesH = 1.0 g/molC = 12.0 g/molO = 16.0 g/molA. 4.3 X 102B. 0.300C. 2.4D. 9.6
Texas A&M - CHEM - 101
EXAM IISample Exam 2-1Dr. V. WilliamsonKeyquestion6pts each(unless noted)1A (B=3 pts)2B3C4A5D6B7D (B=3 pts)8B9B10A (E=3 pts)11E (B=3 pts)12D13C14B = 4 pts15A16A17A Vickie M. Williamson 2007, All Rights Reserved
Texas A&M - CHEM - 101
EXAM II1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.Sample Exam 2-2Dr. V. WilliamsonFORM is EXAM II VERSION 2 (v2)DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.These tests are machine graded; therefore, be sure to use a No. 1 or 2 pencil forma
Texas A&M - CHEM - 101
EXAM IISample Exam 2-2Dr. V. Williamson1. What is the maximum number of grams of Cu that could be produced by the reaction of30.0 g of CuO and 20.0 g of CH4?4CuO + CH4 2H20 + 4Cu + CO2A. 318B. 95.9C. 80.0D. 24.0F. 6.002. Which is the correct fo
Texas A&M - CHEM - 101
EXAM IISample Exam 2-2Dr. V. Williamson8. Which of the following pairs will result in a reaction when 0.1 M aqueous solutions of eachare mixed?A. KOH and NaNO3B. K2SO4 and CrCl3C. Li2CO3 and MgI2D. NiSO4 and CsNO3E. none of these pairs react9. W
Texas A&M - CHEM - 101
EXAM IISample Exam 2-2Dr. V. Williamson3-14. What is the oxidation number of Co in CoCl6 ?A. +6B. -6C. +8D. -3E. +315. Based on the relative reactivities table or activity series provided, which reaction below willoccur?A. 2AgNO3(aq) + Pb(s) 2
Texas A&M - CHEM - 101
EXAM IISample Exam 2-2question1234567891011121314151617Dr. V. WilliamsonKey6pts each(unless noted)D (A=3 pts)DAC (B=3 pts)BE (A=3 pts)BCBECAEEAC= 4 ptsE Vickie M. Williamson 2007, All Rights Reserved
Texas A&M - CHEM - 101
Sample Exam 3-1Dr. V. WilliamsonFORM E is EXAM III, VERSION 1 (v1)1.2.3.4.5.6.7.8.9.10.11.12.13.DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.These tests are machine graded; the refore, be sure to use a No. 1 or 2 pe ncil formarking the
Texas A&M - CHEM - 101
Sample Exam 3-1Dr. V. Williamson1. The ground state electron configuration for Zn is1112A. [Ar]4s 3d2 10D. [Kr]4s 3d101B. [Ar]3s 3d2 10E. [Ar]4s 3d101C. [Ar]4s 3d 4p2. Which one of the following is the electron configuration for the S22
Texas A&M - CHEM - 101
Sample Exam 3-1Dr. V. Williamson8. The Lewis electron-dot structure of HCN (H bonded to C)A. gives N 2 nonbonding (unshared) electron pairsB. gives N 1 nonbonding (unshared) electron pairC. gives C 2 nonbonding (unshared) electron pairsD. gives H 1
Texas A&M - CHEM - 101
Sample Exam 3-1Dr. V. Williamson14. Which one of the following represents a correct set of quantum numbers for an electron in anatom? (arranged as n, 1, m1, and ms)A. 1,0,0,1/2B. 5,4,-5,1/2C. 2,2,-1,-l/2D. 3,3,3,1/2E. 2,0,0,13215. The molecule Z
Texas A&M - CHEM - 101
Sample Exam 3-1Dr. V. Williamson18. What is the shape around the carbon atom labeled 8 AND the shape around the oxygen that isbetween the C and H, respectively?HO8NCCOHHHCHHHA. triangular plane,linearD. t-shaped,linearB. triangular p
Texas A&M - CHEM - 101
Sample Exam 3-2Dr. V. WilliamsonFORM D is EXAM III, VERSION 1 (v1)1.2.3.4.5.6.7.8.9.10.11.12.13.DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.These tests are machine graded; the refore, be sure to use a No. 1 or 2 pe ncil formarking the
Texas A&M - CHEM - 101
Sample Exam 3-2Dr. V. Williamson1. Which sketch(es) could represent a p orbital?A. 4 &amp; 5B. 2 &amp; 3C.l, 4, &amp; 5D. 2, 3, &amp; 4E. 1 only2. Which of the following is FALSE?A. The Wave Mechanical Model of the atom allows one to calculate the probability of
Texas A&M - CHEM - 101
Sample Exam 3-2Dr. V. WilliamsonC. S, because it is the smallest and has a more complete main electron shell.D. Mg, because it is the smallest metal and will not accept an electron easily.E. S, because it is the largest nonmetal and will lose an elect
Texas A&M - CHEM - 101
Sample Exam 3-2Dr. V. Williamson11. The approximate FXeF bond angle between 2 adjacent F in XeF4 isA. 180B. 120C. 109D. 90E. 160-12. What is the formal charge on the I atom in the IO3 ion?A. -3B. +4C. 0D. -lE. +213. Which one of the followi
Texas A&M - CHEM - 101
Sample Exam 3-2Dr. V. Williamson15. There are _ and _ bonds, respectively, inA. 11 and 2B. 13 and 4C. 13 and 0D. 11 and 4E. 13 and 2316. The molecule ZF4 has 1 lone pair of electrons and sp d hybridization. What would youpredict about the polari
Texas A&M - CHEM - 101
Sample Exam 4-1Dr. V. WilliamsonFORM E is EXAM IV, VERSION 1 (v1)1.2.3.4.5.6.7.8.9.10.11.12.13.DO NOT TURN THIS PAGE UNTIL DIRECTED TO DO SO.These tests are machine graded; the refore, be sure to use a No. 1 or 2 pe ncil formarking the a
Texas A&M - CHEM - 101
Sample Exam 4-1Dr. V. Williamson1. Which solid is incorrectly identified by its bonding type?A. CoCl2, ionicD. H2Se, ionicB. Y, metallicE. I2, molecularC. XeF2, molecular2. What is the pressure in atm of 6.022 g CH4 in a 30.0 L vessel at 129C?A.
Texas A&M - CHEM - 101
Sample Exam 4-1Dr. V. Williamson6. According to the kinetic-molecular theory,A. Gas molecules lose small amounts of energy as they collide.B. The pressure exerted on a gas affects the speed of its molecules.C. Gas molecules have rapid straight-line m