QUESTIONS AND ANSWERS
Message Box Syntax - ANS MessageBox.Show("[Message]");
ListBox control - ANS Used to create a ListBox control class object. Properties include Name,
Items, Sorted, SelectedItem, and SelectedIndex. Methods include Items.Add(), Items.Remove(),
and Items.Clear(). Events include SelectedIndexChanged.
for loop - ANS Loops that have a predetermined beginning, end, and increment (step
interval). In the for (i = 0; i <20; i++) { ... }
do-while loop - ANS do { ... } while (condn) Note: Runs through statements at least once
before it reaches the while condition
while loop - ANS while (condn) { ... } Note: Can run for [0, ∞) repetitions
Nested Loop - ANS A loop inside the body of another loop. Your inner loop does a task, which
actually is iterative in nature and your outer loop does that task again and again depending on
your condition.
File I/O - ANS stands for file input/file output.
Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 1
, StreamReader - ANS An object used to open a text file and read streams of text, uses the
ReadLine command
StreamWriter - ANS An object used to open a text file and write to it, uses the WriteLine
command, if true(adds new line) if false(overwrites)
What happens if I don't close a file after I open it to use StreamWriter? - ANS All of the data
in the original file will be erased so make sure you make a copy of the file before using
StreamWriter just in case.
Methods - ANS Creating new custom commands to make programs cleaner/less repetitive
Using methods - ANS To call a method, simply write the following: [name of object].(method
with or without parameters as inputs)
In methods, what is the difference between void and returning? - ANS The void keyword is
used in method signatures to declare a method that does not return a value. A method
declared with the void return type cannot provide any arguments to any return statements
they contain. Methods with return statements take in arguments, manipulate them in some
way, and return a manipulated value of some specified type.
Public vs Private keywords in methods - ANS Public methods are written in one project and
are able to be accessed by other projects. Private methods limit the method's use to only the
project containing it.
Passing parameters by reference - ANS The variable will be passed in updated and passed
back out. Before being referenced by a ref method, variables remain in their initial condition.
Once they are passed through the ref method, the variable remains changed as it was
manipulated in the method.
Passing parameters by value - ANS The variable will be passed in and not updated. Changes
are made to 'copies' of the input variables.
Copyright ©2025 BRIGHTSTARS ALL RIGHTS RESERVED 2