Question
click below
click below
Question
sensitive, free-form programming language that supports
procedural, object-oriented, and generic programming..
Normal Size Small Size show me how
Summative
Programming modules 3 & 4
Question | Answer |
---|---|
_______ is an extension of _______. | C++ is an extension of C. |
________ is a statically typed, compiled, general-purpose, case- sensitive, free-form programming language that supports procedural, object-oriented, and generic programming.. | C++ is a statically typed, compiled, general-purpose, case- sensitive, free-form programming language that supports procedural, object-oriented, and generic programming. |
________ is regarded as a ______________, as it comprises a combination of both __________ and ________ language features. | C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. |
C++ was developed by ____________ | Bjarne Stroustrup |
C++ is an enhancement to the C language and originally named _________ but later it was renamed C++ in 1983. | C with Classes |
#include <iostream> using namespace std; what kind of basic structure is this in c++? | Pre-processor directive |
//This is my first program in C++ what kind of basic structure is this in c++? | Comment |
int main () what kind of basic structure is this in c++? | Main() function |
{ what kind of basic structure is this in c++? | Start of the program |
cout<<"Hello World"; what kind of basic structure is this in c++? | Output statement |
return 0; what kind of basic structure is this in c++? | Return |
} what kind of basic structure is this in c++? | End of the program |
Lines beginning with a hash or pound sign (#) are ______ for ______. They tell the _________ to ________ the source code before compiling | Preprocessor directives Lines beginning with a hash or pound sign (#) are directives for the preprocessor. They tell the compiler to preprocess the source code before compiling. |
No _________ should appear before the #, and ________ is NOT required at the end. | No white space should appear before the #, and semi colon is NOT required at the end. |
Common examples of some __________ are: #include, and #define | Preprocessor directives |
Common examples of some preprocessor directives are: _______, and _____ | #include and #define |
________ directive. It instructs the compiler to add the contents of an include file into your program during compilation. | #include directive |
#include ___________ This specific file ________ includes the declaration of the basic standard input-output library in C++ Examples: cin, cout | <iostream> |
#include __________ The ________ header defines various mathemathical function and one macro Examples: pow, sqrt | <math.h> |
#_________ directive It is used to define symbolic names and constants. | #define |
All lines beginning with two slash signs (//) are considered comments and do not have any effect on the behavior of the program. | Comment Line |
Their purpose is only to allow the programmer to insert notes or descriptions embedded within the source code. | Block Comment |
Comments can also be expressed as | /* block comments */ |
All the elements of the standard C++ library are declared within what is called a _________, the namespace with the name ____ (standard). | NAMESPACE, the namespace with the name STD (standard) |
The function named _____ is a special function in all C++ programs; it is the function called when the program is run. | MAIN |
semi colon is required at the end in : int main() True or False | FALSE (NOT REQUIRED) |
The_________ ({) indicates the _______ of main's function definition. | OPEN BRACE ({) indicates the BEGINNING of main's function |
The ________ (}) indicates its ______. | the CLOSING (}) indicates its END |
Everything between these ________ is the function's body that defines what happens when main is called. | BRACES |
All functions use _______ to indicate the beginning and end of their definitions | BRACES |
A statement is a simple or compound expression that can actually produce some effect. | Program statement |
It is the meat of a program, specifying its actual behavior. Each statement must be terminated by a semicolon (;) | Program Statement |
A _________, also called a block, is a group of two or more C++ statements enclosed in braces. | Compound Statement |
This defines the exit status of the process or application. | RETURN 0; |
It terminates main( ) function and causes it to return the value 0 to the calling ________. | PROCESS |
Return 0 should end with_____________. | SEMICOLON |
Characters that can be used in a program are 1. ____________ 2. ____________ 3. ____________ 4. ____________ 5. ____________ | 1. Lowercase letters (a-z) 2. Uppercase letters (A-Z) 3. Digits (0-9) 4. Special Characters (+,-,*,/,=,(,),{,}……) |
________are reserved words with special meaning in C++ | KEYWORDS |
Keywords Other names which you should not use as variables are the names of data types such as ___, ______, _____. | |
A C++ identifier is a name used to identify a ______, _____, ______, ________, or any other user-defined item | Variable, function, class, module |
A ________ is a name used to identify a variable, function, class, module, or any other user-defined item. | C++ identifier |
An identifier starts with a letter ______ or ______ or an ______ (_) followed by _____ or more ______, _____, and _____ (0 to 9). | An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9). |
True or False. C++ does not allow punctuation characters such as @, $, and % within identifiers. | TRUE |
C++ is a________ programming language. | Case-sensitive |
______ and ______ are two different identifiers in C++. | Manpower and manpower |
A _____ is also known as user-defined identifier. | Variable |
a ________ is a __________ that has a value, which can change during program execution. | A VARIABLE is a STORAGE LOCATION that has a value which can change during program execution |
TRUE or FALSE. By using a variable’s name in your program, you are, in effect referring to the data stored there. | TRUE |
True or False. You must initialize a variable - probably giving it a value of zero - before you use it in a calculation or you need to make sure that it is given a value in some other way. Otherwise, it contains a random number. | TRUE |
TRUE or FALSE All variables in C++ must be declared prior to their use. | TRUE |
Variables can be given any name up to_________ in length | 31 CHARACTERS |
A variable is also known as ___________. It is a data storage location | user-defined indentifier |
Creating a variable name Characters _______and________ | a to z and A to Z |
Creating a variable name The ______ must be a ______ | First character must be a letter |
Creating a variable name Only ___, ______, or _______ may follow the initial letter | Only letters, digits or underscores may follow the initial letter. |
Creating a variable name _______ and ___________ are not allowed. | Blank spaces and special characters |
Creating a variable name Use _________ to separate words in a name consisting of multiple words or _________ the first letter of one or more words. | Use UNDERSCORE to separate words in a name consisting of multiple words or CAPITALIZE the first letter of one or more words. |
Creating a variable name Do not use _________ as the first character of a name. | UNDERSCORE |
Creating a variable name Must not be any of the _____ keywords. | 32 |
Creating a variable name Variable names must be ________ | MEANINGFUL |
All variables use_____ during declaration to restrict the type of data to be stored. | DATA-TYPE |
_________ are used to tell the variables the type of data it can store | DATA-TYPE |
TRUE OR FALSE. Whenever a variable is defined in C++, the compiler allocates some memory for that variable based on the data-type with which it i declared. | TRUE |
Every data type requires __________. | DIFFERENT AMOUNT OF MEMORY |
Every _________ requires different amount of memory. | DATA TYPE |
_________ are built-in or predefined data types and can be used directly by the user to declare variables. | PRIMITIVE DATA TYPES |
Primitive Data Types are ___________ and can be used directly by the user to ________. Examples: int, char, float, bool etc. | BUILT-IN OR PREDEFINED DATA TYPES and can be use directly by the user to DECLARE VARIABLES |
True or False. Primitive data types available in C++ are: Integer Character Boolean Floating Point Double Floating point Valueless or Void Wide Character | TRUE |
___________ are used with the built-in data types to modify the length of data that a particular data type can hold. | DATATYPE MODIFIERS |
True or False. Data type modifiers available in C++ are: Signed Unsigned Short Long | TRUE |
_______ data type is used for storing (+/-) whole numbers. | INTEGER |
Keyword used for integer data types is _____. | int |
Integers typically requires _______ and ranges from -2147483648 to 2147483647. | 4 BYTES OF MEMORY SPACE |
_________ data type is used for storing characters. | CHARACTER |
Keyword used for character data type is _______. | char |
Characters typically requires _______ and ranges from -128 to 127 or 0 to 255. | 1 byte of memory space |
________ data type is used for storing boolean or logical values | BOOLEAN |
A boolean variable can store either _____ or _____. | TRUE OR FALSE |
Keyword used for boolean data type is ________. | bool |
_______ data type is used for storing single precision floating point values or decimal values. | Floating Point |
Keyword used for floating point data type is _______. | float |
Float variables typically requires______________ space. | 4 BYTES OF MEMORY |
___________ data type is used for storing double precision floating point values or decimal values. | DOUBLE FLOATING POINT |
Keyword used for double floating point data type is ______. | double |
Double variables typically requires ___________ space. | 8 bytes |
____ datatype represents a valueless entity or without any value. | void |
It is used for those function which does not returns a value. | void |
_______ data type is also a character data type but this data type has size greater than the normal 8-bit datatype. | Wide Character |
Wide Character is represented by ________ It is generally 2 or 4 bytes long | wchar_t. |
The other way to initialize variables, known as________, is done by enclosing the initial value between parentheses (). | CONSTRUCTOR INITIALIZATION |
THREE PLACES IN C++ PROGRAM WHERE VARIABLES CAN BE DECLARED Outside of all functions, including the main() function. This sort of variable is called _______ and may be used by any part of the program. | global |
THREE PLACES IN C++ PROGRAM WHERE VARIABLES CAN BE DECLARED Inside the function. Variables in this way are called ____ variables and may be used only by statements that are also in the same function. | local |
THREE PLACES IN C++ PROGRAM WHERE VARIABLES CAN BE DECLARED In the declaration of a formal parameter of a _____. The formal parameters are used to receive the arguments when that function is called. | function |
A _____ is any expression that has a fixed value | CONSTANT |
Unlike a variable, the value stored in a _____ cannot be changed during program execution. | CONSTANT |
CONSTANT A character is enclosed between _____ | SINGLE QUOTES ( ' ) |
CONSTANT ______ contains a series of characters enclosed by ______ | String constant contains a series of characters enclosed by double quotation. |
CONSTANT ______ are specified as numerical (whole number) constants without fractional components. | INTEGER NUMBERS |
CONSTANT ______ (“) to express a numerical constant. | NO NEED TO WRITE QUOTES |
CONSTANT _______ require the _____ followed by the number’s fractional component. | FLOATING POINT CONSTANTS require the USE OF DECIMAL POINT |
With the _____ keyword you can declare constants with a specific type in the same way as you would do with a variable. | const |
_____ are the symbols that tell the compiler to perform specific mathematical or logical manipulations. | Operators |
True or False. Types of Operators: Assignment Operator • Arithmetic Operators • Compound Operators • Relational Operators • Logical Operators | TRUE |
In C++, _____ is a single equal sign (=) which means that the value on the right side of the assignment expression after the equal sign is assigned to the variable on the left. | assignment operator |
ARTITHMETIC OPERATORS _______ specifies the order of operations in expressions that contain more than one operator. | OPERATOR PRECEDENCE |
ARITHMETIC OPERATORS Operator precedence specifies the ________that contain more than one operator. | ORDER OF OPERATIONS IN EXPRESSIONS |
TRUE OR FALSE. Operator associativity specifies whether, in an expression that contains multiple operators with the same precedence, an operand is grouped with the one on its left or the one on its right. | TRUE |
The ____ operator ++ adds 1 to its operand | INCREMENT |
the _______ operator -- subtracts 1 from its operand. | DECREMENT |
Both the increment and decrement operators can either precede (___) or follow (___) the operand. | PREFIX or follow POSTFIX |
These are operators that allow the comparison of two or more numerical values, yielding a result based on whatever the comparison is true(1) or false(0). | RELATIONAL OPERATORS |
These operators are used to combine two or more conditions or to complement The evaluation of the original condition in consideration. | LOGICAL OPERATORS |
The result of the operation of a logical operator is a ____ value either ___ or ____. | The result of the operation of a Logical operator is a boolean value either true or false. |
Conditional operators are also called as ______. | TERNARY OPERATORS |
______ operator works on bits and perform bit-by-bit operation. | BITWISE OPERATOR |
Binary AND Operator copies a bit to the result if it exists in both operands. ( & ) TRUE OR FALSE | TRUE |
Binary OR Operator copies a bit if it exists in either operand. ( | ) TRUE OR FALSE | TRUE |
Binary XOR Operator copies the bit if it is set in one operand but not both. ( ^ ) TRUE OR FALSE | TRUE |
Binary Ones Complement Operator is unary and has the effect of 'flipping' bits. ( ~ ) TRUE OR FALSE | TRUE |
Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand. ( << ) TRUE OR FALSE | TRUE |
Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. ( >> ) TRUE OR FALSE | TRUE |
In C++, input and output (I/O) operators are used to _____ and ________. | take input and display output |
he operator used for taking the input is known as the_____ or get from operator (>>) | extraction |
while the operator used for displaying the output is known as the ______ or put to operator (<<). | insertion |
The standard C++ library includes the header file ______, where the standard input and output stream objects are declared. | iostream |
______ operator (<<) is commonly known as the output operator. | insertion |
Insertion operator (<<) is commonly known as the _______. | output operator |
The standard output by default is the screen, and the C++ stream object defined to access it is _____. | cout |
Multiple insertion operations (<<) may be chained in a single statement. true or false | TRUE |
Chaining insertions is especially useful to____ and ______ in a single statement | mix literals and variables |
______ does not do automatically add line breaks at the end, unless instructed to do so | cout |
to______, a new-line character shall be inserted at the exact position the line should be broken. | insert a line break |
In C++, a new-line character can be specified as ____ | \n |
______ are used to represent certain special characters within string literals and character literals. | Escape codes/sequences |
__________(>>) is commonly known as the input operator. | extraction operator |
Extraction operator (>>) is commonly known as the _______. | input operator |
The standard input by default is the keyboard, and the C++ stream object defined to access it is ______. | cin |
int age; cin >> age; The cin statement waits for an input from the keyboard in order to store the integer variable _____ | age |
int num1, num2; cin >> num1>>num2; The ___ statement waits for two inputs from the keyboard separated by a space in order to store the integer variables ____ and ___ respectively. | cin num1 num2 |
The object ____ is connected to the input device. | cin |
The object cin is connected to the_____. | input devicie |
Input Strings using ______ directive and getline(); | <string.h> |
______ is a standard library function in C++ and is used to read a string or a line from input stream. It is present in the ______ header. | getline() <string> |
_____ is a standard library function in C++ and is used to read a string or a line from input stream. | getline() |
getline() takes the stream ____ as first argument, and the string variable as second. | cin |
_______ is the process of converting one predefined type into another. | Type conversion |
C++ facilitates the type conversion into the following two forms : •______Conversion • ______Conversion | • Implicit Type Conversion • Explicit Type Conversion |
Implicit also known as_______. It is a conversion performed by the compiler without programmer's intervention. | Automatic type conversio |
_____ also known as automatic type conversion. | IMPLICIT |
Conversion from one data type to another is prone to _____. This happens when data of a larger type is converted to data of a smaller type. | DATA LOSS |
The explicit conversion of an operand to a specific type is called _____. | TYPE CASTING |
An explicit type conversion is user-defined that forces an expression to be of specific data type. This is the general form to perform type casting in C++: | (datatype) expression; |
____ is used to find the power of the given | pow() |
while _____ returns the square root of value. | sqrt() |
pow() is used to find the power of the given number while sqrt() returns the square root of value. These math functions are part of ______ header | <math.h> |
______ and _____ functions, both are used to retrieve or calculate the absolute value. | abs() and fabs() |
_____ is used to calculate the absolute value for integer type numbers | abs() |
whereas _____ are used for floating type numbers. | fabs() |
The ____ and ____ functions map a real number to the greatest preceding or the least succeeding integer, respectively. | floor and ceiling |
The floor and ceiling functions map a ______ to the greatest preceding or the least succeeding integer, respectively. | real number |
The floor and ceiling functions map a real number to the _____ preceding or the _____ succeeding integer, respectively. | greatest, least |
The floor and ceiling functions map a real number to the greatest preceding or the least succeeding integer, respectively. Also, they are part of _____ header. | <math.h> |
______ is used to round (truncate) the value toward zero and returns the nearest integral value. | trunc() |
_____is used to round the given number to the closest integer. | round() |
_____ when used along with ‘fixed’ provides precision to floating point numbers correct to decimal numbers mentioned in the brackets of the setprecision. | setprecision |
setprecision function is part of _____ header. | <iomanip> |