Name:
Class:
Date:
Page 1
True / False
1. Most programming languages have a way to branch, loop, and test.
a.
True
b.
False
ANSWER:
True
2. Bugs are worse than syntax errors because a program can run successfully with a bug, but the output might be
incorrect or inconsistent.
a.
True
b.
False
ANSWER:
True
3. You must always add “//” at the end of comment text when using C language.
a.
True
b.
False
ANSWER:
False
4. When a compiler finds errors, it usually indicates what they are so you can correct the code and compile the
program again.
a.
True
b.
False
ANSWER:
True
5. Security professionals often need to examine Web pages and recognize when something looks suspicious.
a.
True
b.
False
ANSWER:
True
Multiple Choice
6. Carelessly reviewing your program’s code might result in having which of the following in your program
code?
a.
branch
b.
virus
c.
bug
d.
variable
ANSWER:
c
7. Which of the following is a mini-program within a main program that carries out a task?
a.
function
b.
script
c.
branch
Name:
Class:
Date:
Page 2
d.
loop
ANSWER:
a
8. Which of the following takes you from one area of a program (a function) to another area?
a.
Branching
b.
Looping
c.
Testing
d.
Dividing
ANSWER:
a
9. Which of the following is the act of performing a task over and over?
a.
Branching
b.
Looping
c.
Testing
d.
Remembering
ANSWER:
b
10. In object-oriented programming, a function contained in a class is called which of the following?
a.
variable function
b.
label function
c.
test function
d.
member function
ANSWER:
d
11. Which of the following is a backdoor initiated from inside the target’s network that makes it possible to take
control of the target even when it’s behind a firewall?
a.
reverse port
b.
back shell
c.
reverse shell
d.
reverse door
ANSWER:
c
12. UNIX was first written in assembly language. However, it was soon rewritten in what programming
language?
a.
Smalltalk
b.
Perl
c.
Python
d.
C
ANSWER:
d
13. You can use the syntax /* and */ to accomplish what function when working with large portions of text?
a.
run
Name:
Class:
Date:
Page 3
b.
erase
c.
execute
d.
comment
ANSWER:
d
14. Which of the following statements in the C programming language is used to load libraries that hold the
commands and functions used in your program?
a.
#include
b.
package
c.
use
d.
#import
ANSWER:
a
15. In the C programming language, which of the following show where a block of code begins and ends?
a.
braces
b.
parenthesis
c.
brackets
d.
dashes
ANSWER:
a
16. Which of the following special characters is used with the printf() function in the C programming language
to indicate a new line?
a.
\t
b.
\0
c.
\n
d.
\l
ANSWER:
c
17. In the C programming language, which variable type holds the value of a single letter?
a.
Char
b.
Float
c.
String
d.
Const
ANSWER:
a
18. Which of the following mathematical operators in the C programming language increments the unary value
by 1?
a.
+
b.
%
c.
++
d.
&
Name:
Class:
Date:
Page 4
ANSWER:
c
19. Which of the following logical operators in the C programming language is used to compare the equality of
two variables?
a.
=
b.
&&
c.
||
d.
==
ANSWER:
d
20. Which of the following logical operators in the C programming language is evaluated as true if both sides of
the operator are true?
a.
=
b.
&&
c.
||
d.
==
ANSWER:
b
21. In the C programming language, which statement tells the compiler to keep doing what is in the brackets
over and over and over?
a.
loop($)
b.
continue
c.
do(forever)
d.
for(;;)
ANSWER:
d
22. Which of the following is a markup language rather than a programming language?
a.
C
b.
HTML
c.
Perl
d.
PHP
ANSWER:
b
23. In HTML, each tag has a matching closing tag that is written with which of the following characters?
a.
forward slash (/)
b.
backward slash (\)
c.
bang (!)
d.
ampersand (&)
ANSWER:
a
24. If you want to know what the Perl print command does, you can use which of the following commands?
a.
perl -h
Name:
Class:
Date:
Page 5
b.
perldoc -f print
c.
perl -h print
d.
man perl print
ANSWER:
b
25. The print command for Perl is almost identical to the print command used in which of the following
programming languages?
a.
Java
b.
C
c.
PHP
d.
Smalltalk
ANSWER:
b
26. In the Perl programming language, which of the following keywords is used in front of function names?
a.
func
b.
declare
c.
sub
d.
proc
ANSWER:
c
27. In the Perl programming language, variables begin with which of the following characters?
a.
%
b.
!
c.
*
d.
$
ANSWER:
d
28. In the Perl programming language, comment lines begin with the which of the following character(s)?
a.
%
b.
//
c.
#
d.
$
ANSWER:
c
29. In a Perl program, to go from one function to another, you simply call the function by entering which of the
following in your source code?
a.
variable
b.
keyword
c.
name
d.
comment
ANSWER:
c
Name:
Class:
Date:
Page 6
30. In object-oriented programming, which of the following are structures that hold pieces of data and
functions?
a.
classes
b.
variables
c.
keywords
d.
objects
ANSWER:
a
Matching
Match each item with a statement below.
a.
pseudocode
b.
conversion specifier
c.
class
d.
bug
e.
variable
f.
do loop
g.
compiler
h.
while loop
i.
branching
j.
assembly language
31. An English-like language you can use to help create the structure of your program
ANSWER:
a
32. Tells the compiler how to convert the value in a function
ANSWER:
b
33. An object-oriented programming structure that holds pieces of data and functions
ANSWER:
c
34. An error that causes unpredictable results
ANSWER:
d
35. Represents a numeric or string value
ANSWER:
e
36. Performs an action first and then tests to see whether the action should continue to occur
ANSWER:
f
37. Program that converts a text-based program called source code, into executable or binary code
ANSWER:
g
38. A way of having your program repeat an action a certain number of times
Name:
Class:
Date:
ANSWER:
h
39. Takes you from one area of a program (a function) to another area
ANSWER:
i
40. Writing programs in this language is easier than in machine language
ANSWER:
j
Subjective Short Answer
41. What is the difference between the = and = = operators in C?
ANSWER:
Many beginning C programmers make the mistake of using a single equal sign (=) instead of the double equal
sign (= =) when attempting to test the value of a variable. A single equal sign (the assignment operator) is used
to assign a value to a variable. For example, a = 5 assigns the value of 5 to the variable a. To test the value of
variable a, you could use the command “if (a = = 5)”. If you mistakenly wrote the statement as “if (a = 5)”, the
value of 5 is assigned to the variable a, and then the statement is evaluated as true. This is because any value
not equal to zero is evaluated as true, and a zero value is evaluated as false.
42. How does C’s for loop work?
ANSWER:
The for loop is one of C’s most interesting pieces of code. In the following for loop, the first part initializes the
counter variable to 1, and then the second part tests a condition. It continues looping as long as the counter
variable’s value is equal to or less than 10. The last part of the for loop increments the counter variable by 1.
43. How is branching performed in Perl? Give an example.
ANSWER:
In a Perl program, to go from one function to another, you simply call the function by entering the function
name in your source code. In the following example, the &name_best_guitarist line branches the program to
the sub name_best_guitarist function:
# Perl program illustrating the branching function
# Documentation is important
# Initialize variables
$first_name = “Jimi”;
$last_name = “Hendrix”;
&name_best_guitarist;
sub name_best_guitarist
{
printf “%s %s %s”, $first_name, $last_name, “was the best!”;
}
44. The Win32 class contains many functions you can call from your Perl script. How can attackers use these
functions, and should security professionals become proficient at using them in a program?
ANSWER:
Attackers and security professionals can use these functions to discover information about a remote computer.
Although these functions aren’t difficult to understand, becoming proficient at using them in a program takes
After an algorithm is created a programmer would then convert this algorithm into pseudocode. Pseudocode
Name:
Class:
Date: