CS Exam #1 True False Questions

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is a literal constant ?

A literal constant is one in which

(a != 0) and !(a == 0) are complementary logical expressions (the variable a is an integer) True False

False

Double space all lines of code in your program True False

False

It is much easier to find and work with variables if they are defined on the same line. True False

False

The abs function is used with any numeric data type True False

False

The use of a precision modifier when displaying a floating-point value will result in truncating all digits beyond the specified precision value. True False

False, It doesn't truncate it either rounds down or up

Main memory is a place where the programs and data are stored permanently during processing True False

False, Main memory is used for temporary storage however the HARD drive is permanent storage

Within each function the local declarations and executable statements may be permitted to overlap. True False

False, NO the declarations within the function cannot be in the same one as executables.

The compound assignment operator (/=) has a higher level of precedence than the addition operator (+). True False

False, The addition operator is significantly higher than the compound assignment Operator in the order of the compound(14) and the Addition(1-2)

A function that accomplishes multiple processes is functionally cohesive. True False

False, a function should only accomplish one task at a time

A function will always return exactly one value. True False

False, because sometimes functions do not return anything and are voids

Individual tasks in a program may be factored into individual user-defined functions or retained within the main function when an additional user-defined function would be burdensome. True False

False, individual tasks must be factored into individual user-defined functions

The possible result of the following expression for any non-negative integer x is 0 or 1: (x + 1) % x True False

False, it always will return 1 never 0

The logical expression of an if...else construct does not require enclosure in parentheses. True False

False, it is not necessary but for the course it should be followed.

It is not possible to determine if any parameters are passed to a function by address from the declaration statement of the function. True False

False, it is possible to know as it uses the dereferencing(*)operator

It is optional according to the course standards to make use of { and } with if-else constructs True False

False, it is required by course standards to put {} those around the if/else constructs

The function declaration is an executable statement. True False

False, the declaration tells the compiler about a certain function and its features like what is required for that function to run.

An executable file contains code written in a programming language that is to be sent to the compiler. True False

False, the executable file is a file which is created once the compiler goes through the code basically for the purposes of the course called the a.out

The main function beings with a section for preprocessor directives. True False

False, the preprocessor directives comes PRIOR to the main function

The short-circuit method of evaluating logical expressions is only relevant to those expressions that make use of at least one relational operator. True False

False, the short circuit can apply when there is more than one relational operator at play

The size modifier is used to specify the minimum number of positions to reserve for the output of a value. True False

False, the width modifier is USED To specify the minimum # of positions to reserve for the output

The defined constant results in an automatic substitution of the value that follows the symbol everywhere it is found in the program True False

False, you must put the name of the defined constant into each of the areas that you would like to USE it

What does promotion of a data type mean ?

Promotion means that

What was the purpose of RAM ?

RAM is temporary storage but the hard Drive is Permanent storage

To obtain the address of a variable we use the asterisk (*) operator. True False

The asterisk is used when talking about pointers but to get the address of a variable you use the &

(a != 0) and !(a) are complementary logical expressions (the variable a is an integer True False

True

A character constant is enclosed in single quotes. True False

True

A high-level language allows the programmer to concentrate on the problem at hand and not worry about the machine that the program will be using. True False

True

A literal constant is an unnamed constant used to specify data. True False

True

A single-type operation will generate a result of that same type. True False

True

All code found between { and } of the main function is considered to be the body of the function True False

True

Every program must have exactly one function named main. True False

True

In an assignment statement, promotion occurs if the right expression has a lower rank than the variable on the left and demotion occurs if the right expression has a higher rank. True False

True

In downward communication it is only a copy of the data that is sent to the function. True False

True

No code is contained in a structure chart and only demonstrates the function flow through the program. True False

True

One benefit to the use of symbolic languages is improved programming efficiency compared to a machine language True or False ?

True

Operator precedence can be used to bind operators to operands and from that will determine the order of operations in an expression. True False

True

Pseudo-code uses exact programming language syntax to represent a module in the larger program. True False

True

Rarely are single character identifiers (names) for variables considered meaningful. True False

True

Software engineering is the use of sound engineering methods and principles to obtain software that is reliable True or False?

True

The address list of a scanf function must specify where in the memory of the computer the input should be stored True False

True

The coding assignment for lab #3 forbids the use of selection constructs (if, else if, else, switch), logical operators (AND, OR, NOT), and relational operators (<, <=, >, >=, ==, !=). True False

True

The command to create a defined constant is usually placed at the beginning of the program. True False

True

The operand in a postfix or prefix expression must be a variable. True False

True

The preprocessor prepares the code for translation into machine language True False

True

The result of the following expression for any positive (greater than zero) integer x is 0: 1 - (x + 2) % (x + 1) True False

True will always give 0 because the first expression gives a value 2 greater and then doing the modulus gives one more and then subtracting it from ONE results in ZERO always

The void in the following declaration statement would be optional: int getData(void) True False

True, But don't understand why

The function definition contains executable statements that perform the task of the function. True False

True, The function definition is like the RECIPE and contains all the details

Evaluate the following expression: 3 && 6 || 0 True False

True, because it returns 1 which is with true.

Not every function that utilizes pass by address are necessarily void functions. True False

True, because the pass by address can be used for one variable and another variable could be passed by value.

When attempting to print the result of a logical expression that is true as an integer the result will always be 1 True False

True, because true is associated with 1 and the false is associated with a zero.

Complementing a condition is one way to potentially remove negative logic from an expression. True False

True, complementing a condition means taking the opposite of it

Objects with a global scope are visible (defined) everywhere in the program. True False

True, global variables mean they are seen everywhere in the program

When working with a parameter that has been passed by address it is unnecessary to use the & (address) operator in the scanf because a pointer variable already represents a memory location. True False

True, passed by address means it already knows the memory location so you don't have to put the & in front of it.

The logical OR operator is true only when at least one of its operands is true. True False

True, the OR only needs one to be true.

The control of the program always returns from the called function to the calling function. True False

True, the calling function returns the control to the called function

The complement of x >= 3 is x < 3 True False

True, the complement of the compound operator is the <

Parameters are defined as local variables in the function header (the first line of the function definition) and should not be re-defined within the local declaration section of the function. True False

True, the names should not conflict with a different name for the VARIABLES inside of the function

It is a good design practice to create a user-defined function such that it is testable apart from the rest of the program. True False

True, user defined functions are meant to be used multiple times in order to shorten re-writing the same code again

Data sent from the calling function to the function being called will be received in the same order in which it was passed. True False

True, whatever it is passed in will be taken in the same order and because it is PASSED by value it will give a copy to the function

The called function must declare a special type of variable known as a pointer to store a memory address that is sent from the calling function. True False

True, without a pointer there is no reference to any memory location and it can't change the value directly in the memory

The first line of the function definition requires the data types and identifiers for each parameter. True False

True, you must declare what kind of variable you are using in a function

Which of the following data type is required for all variables in lab #1? float double int

float


संबंधित स्टडी सेट्स

Recommended Procedures & Control Measures

View Set

Chapter 12 The World System, Colonialism, and Inequality

View Set

Chapter 1: The Science of Psychology

View Set

Government The Amendments Section 3-4

View Set

BIOL 111G Mastering 11: Communities and Ecosystems

View Set

PEDs Chapts 2, 8, 9, 11, 12, & 13

View Set

4. Muscles of the breast and the arm

View Set