1.
When comparing these two strings, the expression "Zebra" < "aardvark" is...
Correct Answer
A. True
Explanation
The expression "Zebra" < "aardvark" is true because in alphabetical order, "Zebra" comes before "aardvark". The comparison is based on the Unicode value of each character, and since "Z" has a smaller Unicode value than "a", "Zebra" is considered to be less than "aardvark".
2.
The comparison that checks if a variable called intAge is at least 18 is:
Correct Answer
C. If intAge >= 18 Then
Explanation
The correct answer is "If intAge >= 18 Then" because the comparison operator ">=" checks if the value of the variable intAge is greater than or equal to 18. This condition will be true if the value of intAge is 18 or any number greater than 18.
3.
Consider the following code
Dim intA as Integer = 6
Dim intB as Integer = 0
Dim intC as Integer = -1
Is the following expression true or false?
If int A < int B OR intC < int B Then
Correct Answer
A. True
Explanation
The expression is true because at least one of the conditions is true. Since intA is not less than intB, the first condition is false. However, intC is less than intB, so the second condition is true. Since the expression uses the OR operator, only one of the conditions needs to be true for the overall expression to be true.
4.
The condition in an If structure must always evaluate to _____.
Correct Answer
D. True or false
Explanation
The condition in an If structure must always evaluate to either true or false. This is because the If structure is used to make decisions based on whether a certain condition is true or false. If the condition evaluates to true, the code block inside the If structure will be executed, otherwise it will be skipped. Therefore, the condition must always result in a boolean value, either true or false.
5.
An If statement always needs an Else statement.
Correct Answer
B. False
Explanation
We've coded many conditions of If statements with just a Then.
6.
String comparisons are always case sensitive
Correct Answer
A. True
Explanation
Which means ...
If "Giants" = "giants"
Is not true
7.
What is the result of the following expression?Dim m as Integer = 3Dim p as Integer = 10(p - 5 + 4) + (p \ 3 * 2) * m
Correct Answer
27
Explanation
(10 - 5 + 4) + (10 \ 3 * 2) * 3
(5 + 4) + (3 * 2) * 3
9 + 6 * 3
9 + 18
27
8.
It is generally a good idea to use many fonts on a form
Correct Answer
B. False
Explanation
Using many fonts on a form is generally not a good idea because it can make the form appear cluttered and unprofessional. Having a consistent and limited number of fonts helps maintain readability and visual coherence. It is recommended to stick to a maximum of two or three complementary fonts to ensure a clean and organized design.
9.
If a button is assigned to the Form's Cancel property, the button can be clicked by typing the Esc key
Correct Answer
A. True
Explanation
When a button is assigned to the Form's Cancel property, it means that the button is designated as the cancel button for the form. This allows the button to be activated by pressing the Esc key on the keyboard. So, the statement "If a button is assigned to the Form's Cancel property, the button can be clicked by typing the Esc key" is true.
10.
The following statement is a syntax error: sum = sum + 1
Correct Answer
B. False
Explanation
The given statement "sum = sum + 1" is not a syntax error. It is a valid statement in many programming languages, including Python. This statement is used to increment the value of the variable "sum" by 1. It adds 1 to the current value of "sum" and assigns the result back to "sum". Therefore, the correct answer is False.
11.
When keyboard input is directed into a text box, the text box is said to have
Correct Answer
A. Focus
Explanation
When keyboard input is directed into a text box, the text box is said to have "focus". This means that the text box is actively selected and ready to receive input from the keyboard. The concept of focus is important in user interface design as it helps users understand which element is currently active and where their input will be directed.
12.
Which of the following is not a legal variable name?
Correct Answer
C. #tag
Explanation
The variable name "#tag" is not a legal variable name because it starts with a special character (#), which is not allowed in variable names. Variable names in most programming languages should start with a letter or an underscore.
13.
The section of a program where a variable is usable is the variable's
Correct Answer
C. Scope
Explanation
The scope of a variable refers to the portion of the program where the variable is accessible and can be used. It determines the visibility and lifetime of the variable. Therefore, the correct answer is "scope".
14.
What is the result of the following expression? 60 Mod 7
Correct Answer
4
Explanation
Mod means remainder. 60 divided by 7 is 8 remainder 4