Professional Documents
Culture Documents
Filedate 8986
Filedate 8986
Multiple Choice
1. To add an item to a ListBox control with code, you call the control’s
____________method.
a. Add.Items
b. Items.Add
c. Items.Append
d. Items.Insert
ANS: B
2. ListBox controls have an ____________ property that reports the number of items
stored in the ListBox.
a. Items.Count
b. Items.Size
c. Items.List
d. Items.Contains
ANS: A
3. ListBox controls have an ____________ method that erases all the items in the Items
property.
a. Items.Erase
b. Items.Remove
c. Items.Clear
d. Items.Reset
ANS: C
4. Each time a loop executes its statement or statements, we say the loop is performing
a(n) ____________.
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
a. cycle
b. pass
c. execution
d. iteration
ANS: D
5. The ____________ begins with the word while, followed by a Boolean expression that
is enclosed in parentheses.
a. conditional statement
b. logic mark
c. while clause
d. loop parameter
ANS: C
6. The statement or block of statements following the while clause is known as the
____________ of the loop.
a. assembly
b. body
c. definition
d. sequence structure
ANS: B
7. The while loop is known as a ____________, which means it tests its condition before
performing each iteration.
a. posttest loop
b. pretest loop
c. proactive loop
d. preemptive loop
ANS: B
8. ____________ are commonly used to control the number of times a loop iterates.
a. Boolean variables
b. Sentinel variables
c. Counter variables
d. Named constants
ANS: C
b. game loop
c. infinite loop
d. expressionless loop
ANS: C
ANS: D
ANS: C
ANS: B
ANS: B
14. When the ++ and -- operators are written after their operands it is called
____________.
a. prefix mode
b. suffix mode
c. appendix mode
d. postfix mode
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
ANS: D
15. The ++ and -- operators can be written before their operands, which is called
____________.
a. preface mode
b. postfix mode
c. prefix mode
d. superscript mode
ANS: C
16. The ____________ is specifically designed for situations requiring a counter variable to
control the number of times a loop iterates.
a. while loop
b. if-else statement
c. for loop
d. switch statement
ANS: C
17. The first expression appearing in the header of a for loop is the ____________, which
usually assigns a starting value to a counter variable.
a. update expression
b. test expression
c. Boolean expression
d. initialization expression
ANS: D
18. The second expression appearing in the header of a for loop is the _____________,
which is a Boolean expression that determines whether the loop will repeat.
a. test expression
b. update expression
c. initialization expression
d. control expression
ANS: A
19. The third expression appearing in the header of a for loop is the ____________, which
executes at the end of each iteration. It usually increments the loop’s counter variable.
a. test expression
b. update expression
c. initialization expression
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
d. increment expression
ANS: B
20. Because the for loop tests its Boolean expression before it performs an iteration, it is a
____________.
a. pretest loop
b. pseudo loop
c. posttest loop
d. infinite loop
ANS: A
21. Be careful not to place a statement that modifies the counter variable inside the body of
a ____________.
a. while loop
b. if statement
c. for loop
d. switch statement
ANS: C
22. In the header of a for loop, which expression should not end with a semicolon?
a. initialization expression
b. test expression
c. update expression
d. none of these
ANS: C
23. The ____________ is a posttest loop, which means it performs an iteration before
testing its Boolean expression.
a. for loop
b. while loop
c. do-while loop
d. do-before loop
ANS: C
24. The term ____________ is used to describe a file to which data is written.
a. input file
b. output file
c. record file
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
d. recordset
ANS: B
25. The term ____________ is used to describe a file from which data is read.
a. input file
b. output file
c. record file
d. recordset
ANS: A
26. A ____________ contains data that has been encoded as text using a scheme such as
ASCII.
a. document (as on MS-Word or Open-Document Format)
b. spreadsheet (as in Excel)
c. binary file
d. text file
ANS: D
27. A ____________ contains data that cannot be viewed by a text editor (such as
NotePad).
a. source file
b. binary file
c. data file
d. save file
ANS: B
28. When you work with a ____________, you process data from the beginning of the file to
the end of the file.
a. sequential access file
b. direct access file
c. text file
d. input file
ANS: A
29. When you work with a ____________, you can jump directly to any piece of data in the
file without reading the data that comes before it.
a. file object
b. binary file
c. direct access file
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
ANS: C
ANS: B
31. Many systems, including MS-Windows, support the use of ____________, which are
short sequences of characters that appear at the end of filenames and are preceded by
a period.
a. filename extensions
b. pragmatic identifiers
c. binary indices
d. run time signatures
ANS: A
32. A ____________, is an object associated with a specific file and provides a way for the
program to work with that file.
a. data object
b. file object
c. Filename class
d. referential extension
ANS: B
33. In order to write data to a text file, you must create a file object using the
____________.
a. TextReader class
b. TextWriter class
c. StreamReader class
d. StreamWriter class
ANS: D
34. When you want to read data from a text file, you create a file object using the
____________.
a. StreamReader class
b. TextReader class
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
c. BufferedReader class
d. InputReader class
ANS: A
35. You can use the StreamWriter class's ____________ method to write a line of text
to a file.
a. PrintLine
b. WriteText
c. WriteLine
d. PrintText
ANS: C
36. A ____________ character is an invisible character that marks the end of a line of text.
a. line feed
b. newline
c. line marker
d. startline
ANS: B
37. The ____________ is a method in by the StreamWriter class that writes an string to
a text file without writing a newline character.
a. Print method
b. Text method
c. WriteLine method
d. Write method
ANS: D
38. To append data to an existing file, you open it with the ____________ method.
a. File.Append
b. File.AppendAll
c. File.AppendText
d. File.OpenExistingText
ANS: C
39. If you specify a path in a string literal, be sure to prefix the string with the ____________
symbol, also known as the literal text character.
a. #
b. @
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
c. $
d. *
ANS: B
40. You can use the StreamReader class's ____________ method to read a line of text
from a file.
a. ReadLine
b. ReadText
c. GetNext
d. Read
ANS: A
41. A file's ____________ marks the location of the next item that will be read from the file.
a. line marker
b. index value
c. read position
d. newline character
ANS: C
42. You can use the StreamReader class's ____________ to determine if the file's read
position is at the end of the file.
a. EndOfFile property
b. StreamEnd method
c. EndOfStream property
d. EOF method
ANS: C
43. The variable that accumulates a total of the numbers in a running total is called a(n)
____________.
a. counter
b. sentinel
c. entity
d. accumulator
ANS: D
44. A(n) ____________ accumulates a total by adding each number in a series to a variable
that holds the sum.
a. running total
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
b. numeric tally
c. active summary
d. dynamic collection
ANS: A
ANS: B
46. The ____________ is useful in applications that must open an existing file because it
allows the user to browse the system and select the file.
a. File.OpenText method
b. OpenFileDialog control
c. Open dialog box
d. Windows Explorer
ANS: B
47. When controls such as the OpenFileDialog and SaveFileDialog are created, they do not
appear on the form, but in an area at the bottom of the Designer known as the
____________.
a. control overflow
b. design space
c. component tray
d. virtual form
ANS: C
48. If the user clicks the Open button, the OpenFileDialog control's ShowDialog method
returns the value ____________.
a. Result.True
b. DialogResult.OK
c. DialogResult.Open
d. Result.OpenFile
ANS: B
49. When the user selects a file with the Open dialog box, the file's path and filename are
stored in the control's ____________.
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
a. FilePath property
b. Source property
c. Location property
d. Filename property
ANS: D
50. You can specify the directory to be initially displayed by the Open dialog box by storing
its path in the ____________.
a. InitialDirectory property
b. Source property
c. Filename property
d. Path property
ANS: A
51. You can change the default text displayed in the Open dialog box's title bar by changing
the control's ____________.
a. Caption property
b. Text property
c. Title property
d. Heading property
ANS: C
ANS: B
53. The ____________ allows the user to browse the system and select a location and name
for a file that is about to be saved.
a. Save As dialog box
b. Save File dialog box
c. Select Source dialog box
d. Open dialog box
ANS: A
54. In code, you can display a Save As dialog box by calling the SaveFileDialog control's
____________ method.
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
a. SaveAs
b. Show
c. ShowDialog
d. Display
ANS: C
55. If the user clicks the Cancel button, the SaveFileDialog control's ShowDialog method
returns the value ____________.
a. Result.False
b. DialogResult.Cancel
c. DialogResult.Abort
d. Result.NULL
ANS: B
56. The .NET Framework provides a class named ____________ that you can use in C# to
generate random numbers.
a. Rand
b. Random
c. GenNum
d. RandomGenerator
ANS: B
57. The expression ____________ causes an object of the Random class to be created in
memory.
a. GetRandom(int)
b. GenerateRandom(number)
c. new Random()
d. random new()
ANS: C
58. Once you have created a Random object, you can call its ____________ method to get
a random integer number.
a. Next
b. GetInteger
c. GenerateNumber
d. NextInteger
ANS: A
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
59. You can call a Random object's ____________ method to get a random floating-point
number between 0.0 and 1.0.
a. GetDouble
b. NextFloat
c. NextDouble
d. DoubleRand
ANS: C
ANS: A
ANS: C
62. When you run an application, the application's form is loaded into memory and an
event known as the ____________ takes place.
a. Load event
b. Launch event
c. Boot event
d. Initialization event
ANS: A
STOPPED HERE
True or False
1. You can only add values of the string data type to a ListBox control.
ANS: F
ANS: F
3. The while loop gets its name from the way it works: While a Boolean expression is
true, do some task.
ANS: T
4. If you are writing a while loop that has only one statement in its body, you do not have
enclose the statement inside curly braces.
ANS: T
5. By indenting the statements in the body of a loop, you visually set the loop body apart
from the surrounding code.
ANS: T
6. A while loop will always iterate at least once, even if the Boolean expression is initially
false.
ANS: F
7. Counter variables are commonly used to hold Boolean values that control the number of
times a loop iterates.
ANS: F
ANS: T
9. The ++ operator is pronounced “plus plus” and the -- operator is pronounced “minus
minus”.
ANS: T
10. Incrementing and decrementing are so commonly done in programs that C# provides
the ++ and -- unary operators for just these purposes.
ANS: T
11. When you write a stand-alone statement to increment a variable, the prefix operator is
faster than the postfix version.
©2017 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
ANS: F
12. The first line of the for loop is known as the loop title.
ANS: F
13. It is possible to write a for loop in such a way that it will never iterate.
ANS: T
14. Not only may the counter variable of a for loop be initialized in the initialization
expression, but it may also be declared there.
ANS: T
15. When a variable is declared in the initialization expression of a for loop, the scope of
the variable is limited to the loop.
ANS: T
16. In the update expression of a for loop, you must use the ++ operator in the increment
expression.
ANS: F
17. In a counter-controlled loop, you can only decrement the counter variable.
ANS: F
18. The do-while loop always performs at least one iteration, even if its Boolean
expression is false to begin with.
ANS: T
ANS: T
20. There are always three steps that must be taken when a file is used by a program:
opening the file, processing the file, and then closing the file.
ANS: T
21. In general, there are three types of files: text, binary, and bitmap.
Another random document with
no related content on Scribd:
The Project Gutenberg eBook of Jutelmia
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Title: Jutelmia
Kynän pärskeitä
Language: Finnish
Kynän pärskehiä
Koonnut
SISÄLLYS:
Luonnon helmassa.
Haaksirikko.
Vasarakauppa.
Väärällä tiellä.
LUONNON HELMASSA.
I.
"Niin, niin, aja vain, kun kerran ajamassa olet!" kehoitti rouva
Lajunen. Hänestä näet kesäkuun ensimmäisten päiväin koko
terältään paahtava aurinko alkoi liialta rasitukselta tuntua hänen
tuossa istuessaan Turun kärrien etusijalla miehensä vieressä ja
pidellessään nuorinta lasta sylissään.
Mutta mäen alla oli vielä tilaa kahdellekin talonsijalle, joiden välitse
tie loivasti laskeutui rantatörmän päälle, pudottautui siitä edelleen
törmän alle ja kääntyi kiertämään toisen talon peltoja, jotka ulottuivat
hyvän matkan pitkin rantaa samoin kuin toisen talon viljamaat
toisella puolella.
Lehtori kääntyi katsomaan, mikä oli hätänä. Hilja juoksi äitinsä luo.
"Eikö hänellä ollut aikaa sitä ennen tehdä?" torui rouva. "Niin käy
aina, kun ei itse ole katsomassa. Ei ne saa mitään aikaan."
"Älähän nyt joutavia! Kyllä kai Marilla on eilisestä asti ollut kylliksi
tekemistä. Ja muuten, enkö minä täällä maallakaan saisi mihinkään
koskea."
Lehtori nosti korin. Rouva Streng puoli väkisin tarttui sen toiseen
päähän kantamaan sitä maantieltä Lajusten asuntoon.
Melkein samaan jatkoon huusi hän taas Hiljan esiin ja lähetti hänet
kutsumaan Maria, joka tällä kertaa pian saapuikin.
"En minä huoli. Väsyttipä tuo matka, kun olikin niin pitkä!" valitti
rouva Lajunen haikeasti.
"Se minusta ei niin paha vastus ole. Vaan täällä ei ole edes
ainoatakaan puuta, jonka siimekseen pääsisi huoneiden
kuumuudesta. Kotona kaupungissa kun astuisin vain alas rappusilta,
niin olisi kylliksi varjoa."
"Onhan tuo niinkin", myönsi rehtori. "Eikä täällä saa kokoon wisti-
klubia, eikä ole lukusaliakaan, jossa sanomalehtiä näkisi. Miten tämä
kesä todellakin kuluneekaan?"
Sisälle päästyä rouva Streng pyysi anteeksi, että hänellä oli vain
tavallista kotiruokaa tarjota, maalla kun ei käynyt noudattaa
kaupungin tapoja.
"Kun kehtaakaan tuo rouva Streng pyytää teelle, vaikka ei ole sen
parempaa tarjota!"
"Niin sinä järjestät, kuin sinulla ei olisi yhtään järkeä. Kutsu Katri ja
nostakaa piironki kulmittain!"
II.
Rahallisesti nukuttuaan yönsä riisuutumattakin heräsi lehtori Lajunen
aikaisin seuraavana aamuna. Vähän ensin oudostutti tuo olo
makuulla vaatteissaan, mutta pian sentään muistui jo mieleen kaikki
eilispäivän ja -illan tapaukset. Hän ei ollut koskaan tottunut
venytteleimään aamusilla vuoteella, vaikka olisi kuinka väsyksissä
levolle käynyt; hän näet oli kasvanut talonpoikaisessa ahkerassa
kodissa, jossa ei kuhnustelemista suvaittu.
Niinpä hän nytkin, kun sai silmänsä auki, kerran vain hypähti ja
seisoi jo lattialla kykenevänä ryhtymään mihin työhön hyvänsä.
"Itsekö?"
"Onko se huonoa?"
"Jo nyt laskette leikkiä. Ette te vielä niin vanha mies ole."
"Rukiitako?"