CC6051 Ethical Hacking quiz 7

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A loop usually completes after ____________________ is conducted on a variable and returns a value of true or false.

testing

represents a numeric or string value

variable

The logical operator in C that is used to compare the equality of two variables is ____. Answer = && || ==

==

In programming, what are variables used for?

A variable represents a numeric or string value.For example, you can solve x + y = z if you know two of the variable values. In programming, you can declare variables at the beginning of a program so that calculations can be carried out without user intervention. A variable might be defined as a character or characters, such as the letters of the alphabet, or it can be assigned a numeric value, as in the expression int x = 1.

In Perl, comment lines begin with the ____ character(s). Answer % // # $

#

The ____ statement in C is used to load libraries that hold the commands and functions used in your program. Answer #include package use #import

#include

In Perl, variables begin with the ____ character. Answer % ! * $

$

The mathematical operator in C that increments the unary value by 1 is ____. Answer + % ++ &

++

You can use /* and */ instead of ____ symbol(s) for one-line comments in C. Answer # #! ** //

//

The Win32 class contains many functions you can call from your Perl script. How can attackers use these functions? Should security professionals become proficient at using them in a program?

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 time and discipline. For security professionals who need to know what attackers can do, gaining this skill is worth the time and effort.

___ takes you from one area of a program (a function) to another area. Answer Branching Looping Testing Dividing

Branching

The print command for Perl is almost identical to the ____ print command. Answer Java C PHP Smalltalk

C

UNIX was first written in assembly language, soon rewritten in ____. Answer Smalltalk Perl Python C

C

The C programming language was developed by ____ at Bell Laboratories in 1972. Answer James Gosling Larry Wall Dennis Ritchie Larry Tesler

Dennis Ritchie

____ is the act of performing a task over and over. Answer Branching Looping Testing Remembering

Looping

What is the difference between the = and = = operators in C?

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.

HTML doesn't use branching, looping, or testing. Answer True False

True

Security professionals often need to examine Web pages and recognize when something looks suspicious. Answer True False

True

To compile the "syntax.c" program in *nix you enter the gcc -c syntax.c -o syntax.o command. Answer True False

True

The ____ special character is used with the printf() function in C to indicate a new line. Answer \t \0 \n \l

\n

The ____ special character is used with the printf() function in C to indicate a tab. Answer \t \0 \n \l

\t

structure that holds pieces of data and functions

class

converts a text-based program, called source code, into executable or binary code

compiler

tells the compiler how to convert a value in a function

conversion specifier

performs an action first and then tests to see whether the action should continue to occur

do loop

Most programming languages do not have a way to conduct testing of a variable.

False

Why is documenting computer programs essential?

When writing any computer program, documenting your work is essential. To do this, you add comments to the code that explain what you're doing. Documentation not only makes your program easier for someone else to modify; it also helps you remember what you were thinking when you wrote the program. The phrase "No comment" might be appropriate for politicians or Wall Street investors with inside trading information, but not for computer programmers.

error that causes unpredictable results

bug

In C, the statement ____ tells the compiler to keep doing what's in the brackets over and over and over. Answer loop continue do(forever) for(;;)

for(;;)

GNU C and C++ compilers

gcc

C programs must contain a(n) ____________________ function, but you can also add your own functions to a C program.

main() or main

English-like language you can use to help create the structure of your program

pseudocode

In Perl, the keyword "____" is used in front of function names. Answer func declare sub proc

sub

____________________ language uses a combination of hexadecimal numbers and expressions, such as mov, add, and sub, making it easier for humans to write programs than in binary or machine language.

Assembly

Mention three C compilers and on which operating systems they are available.

Intel Compilers for Windows and Linux: Intel's C++ compiler for developing applications for Windows servers, desktops, and handheld PDAs. The Intel Linux C++ compiler claims to optimize the speed of accessing information from a MySQL database, an open-source database program used by many corporations and e-commerce companies. Microsoft Visual C++ Compiler: This compiler is widely used by programmers developing C and C++ applications for Windows platforms. GNU C and C++ compilers (GCC): These free compilers can be downloaded for Windows and *nix platforms. Most *nix systems include the GNU GCC compiler.

What is a dangerous thing about programming in the C language?

What's dangerous about C is that a beginner can make some big blunders. For example, a programmer can write to areas of memory that cause damage to the OS kernel or, even worse, write a program that allows a remote user to write to areas of memory. Usually, what's written is executable code that might give an attacker a backdoor into the system, escalate an attacker's privileges to that of an administrator, or simply crash the program. This type of attack is usually possible because the programmer didn't check users' input. For example, if users can enter 300 characters when prompted to enter their last names, an attacker can probably enter executable code at this point of the program. When you see the term "buffer overflow vulnerability," think "poor programming practices." Although C is easy to learn and use, errors in using it can result in system damage.

Software engineering firms don't retain computer programmers who do not document their work because they know that 80% of the cost of software projects is ____. Answer documentation debugging testing maintenance

maintenance

Structures called classes can be written in many ____________________ languages (Java, Object COBOL, or Perl).

object-oriented

If you want to know what the Perl print command does, you can use ____. Answer perl -h perldoc -f print perl -h print man perl print

perldoc -f print

checks whether a condition is true and then continues looping until the condition becomes false

while loop

Many scripts and programs for security professionals are written in ________________________________________, a powerful scripting language.

Practical Extraction and Report Language PERL Practical Extraction and Report Language (PERL) PERL (Practical Extraction and Report Language)

A ____ is a mini program within a main program that carries out a task. Answer function script branch loop

function

List and describe the variable types used in C.

int: Use this variable type for an integer (positive or negative number). float: This variable type is for a real number that includes a decimal point, such as 1.299999. double: Use this variable type for a double-precision floating point. char: This variable type holds the value of a single letter. string: This variable type holds the value of multiple characters or words. const: A constant variable is one you create to hold a value that doesn't change for the duration of your program. For example, you can create a constant variable called TAX and give it a specific value: const TAX - .085. If this variable is used in areas of the program that calculate total costs after adding an 8.5% tax, it's easier to change the constant value to a different number if the tax rate changes, instead of changing every occurrence of 8.5% to 8.6%.

How is branching performed in Perl?

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!"; }

How does C's for loop work?

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 until the value of counter is equal to or less than 10. The last part of the for loop increments the counter variable by 1


Ensembles d'études connexes

External Accreditation One: Overview

View Set

D-02 Distinguish Between Interval & External Validity

View Set

初一英语 unit 2 (2-family)

View Set

Assignment Energy Workplaces and Tasks

View Set

Chapter 16 (Disease and Epidemiology)

View Set

RUOE PT. 4 - Complete First Unit 9 , pg. 101 (acts. 1 and 2)

View Set

Animal Learning and Cognition Exam 2

View Set

Ciao! Ch.1- La città -vocabulary

View Set