Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

1. When planning a computer program, what should a programmer always do?

Make a flowchart.
Write pseudocode.
Start working on the program and plan as you go.
Either draw a flowchart or write pseudocode.
______________________________________…
2. What is the term for computer languages that allow programmers to write code by focusing on
how different objects interact with one another?
Programmer-oriented.
Object-oriented.
Procedure-oriented.
Code-oriented.
______________________________________…
3. What is the name of a program that takes instructions written using mnemonics and translates
them into a language that the computer can understand?
Compiler.
Assembler.
Converter.
Translator.
______________________________________…
4. Which of the following characters ends every C# statement?
Period (.).
Colon (:).
Semicolon (;).
Comma (,).
______________________________________…
5. To compile a C# source code file named MyFile.cs, what would you type at the command
prompt?
csc.exe MyFile.exe
csc.exe MyFile
csc MyFile.cs
csc MyFile
______________________________________…
6. What does it mean if you compile your C# source code file and you only get copyright
information about Microsoft as a response?
You have not set the path to the compiler correctly.
Your program has syntax errors that you must correct before you can compile the program.
The compiler cannot find the source code file that you are trying to compile.
The compiler successfully compiled your program.
______________________________________…
7. What is the output from the following line of code? System.Console.Out.WriteLine( 1.7 +
(int) 1.9 / 3);
Zero.
One.
Two.
1.7
______________________________________…
8. Assume that you have an int variable named 'number' that is storing the value 4. What is the
output from the following line of code? System.Console.Out.WriteLine("number " + number);
number 4
4 number
8
number number
______________________________________…
9. Which of the following lines of code will correctly attempt to convert a String variable named
'age' to an int and store that value in a variable named ageAsInt'?
ageAsInt = Convert.ToInt32(age);
ageAsInt = Convert.ToInt32(String age);
Convert.ToInt32(age);
Convert.ToInt32(ageAsString);
______________________________________…
10. Which of the following lines of code will display the value of the variable 'base' raised to the
power of the value of the variable 'power'?
System.Console.Out.Write(Math.Pow(base, power));
System.Console.Out.Write(Math.Pow(power, base));
System.Console.Out.Write(''Math.Pow(base… power)'');
System.Console.Out.Write(Math.Pow(''powe… "base''));
______________________________________…
11. How many values can a value-returning method use in its return statement?
None. A value-returning method does not use a return statement.
One value only.
One or more values.
As many values as the programmer wants.
______________________________________…
12. Which of the following lines of code will return the contents of the 'result' variable to the
calling method?
return int result;
int result return;
result return;
return result;
______________________________________…
13. Which of the following statements about void methods is correct?
Void methods do not have a return type in the header.
Void methods must have a return statement in the method body.
Void methods cannot have a return statement in the method body.
Void methods can have a return statement in the method body, but it is not required.
______________________________________…
14. Which of the following method headers receives a reference to an int variable and the value
of an int variable?
public static void CSharp(ref int a, ref int b)
public static void CSharp(ref int a, int b)
public static void CSharp(int a, int b)
public static void CSharp(ByRef int a, int b)
______________________________________…
15. In C#, by default all variables are passed how?
By memory.
By value.
By reference.
By address.
______________________________________…
16. If you want to create a statement block, you must enclose your statements inside which two
characters?
Parentheses ( ).
Square brackets [ ].
Braces { }.
Angle brackets < >.
______________________________________…
17. Which of the following is true regarding statement blocks and if . else statements?
C# does not allow you to write statement blocks inside the true path or the false path.
You can write statement blocks inside the true path, but not inside the false path.
You can write statement blocks inside the false path, but not inside the true path.
C# allows you to write statement blocks inside either the true path or the false path, i

 1 year ago

You might also like