FA3 Flashcards
All lines beginning with two slash signs (//) do have any effect on the behavior of the program.
Group of answer choices
True
False
False
C++ is not case-sensitive programming language.
Group of answer choices
True
False
False
Which of the following is not an example of program statements seen inside a main() function?
Group of answer choices
read keyboard input such as cin»number;
perform mathematical operations such as sum = a + b;
preprocessor directive such as #define FALSE 0
display information on the screen such as cout«”Hello”;
preprocessor directive such as #define FALSE 0
The following statements are true about C++ except __________.
Group of answer choices
It uses compilation process.
It is a low-level language.
It is case sensitive.
It supports procedural, object-oriented, and generic programming.
It is a low-level language.
Which of the following symbols is best used to make a 20-line statements as block comment?
Group of answer choices
/* */
??
//
/* */
Namespace std contains all the classes, objects and functions of the standard C++ library.
Group of answer choices
True
False
True
All C++ statements that need to be executed are written within main ( ).
Group of answer choices
True
False
False
The symbols that indicates the beginning of main’s function definition.
Group of answer choices
}
{
<>
#
{
Two slash signs inserted by the programmer in his C++ program indicate that the rest of the line is a comment.
Group of answer choices
True
False
True
These are names that are given to various elements of a program created by the program.
Group of answer choices
Tokens
Identifiers
Constants
Keywords
Identifiers
An operator that is also called ternary operator.
Group of answer choices
Conditional Operator
Increment Operator
Triad Operator
Modulo Operator
Conditional Operator
The following statements are TRUE in creating identifiers except _______
Group of answer choices
Special characters are allowed.
An identifier must not be one of the keywords.
Blank spaces are not allowed instead use underscore(_).
The first character must be a letter or underscore.
Special characters are allowed
A sequence of letters, digits or underscore that may be used as a name of a variable, function, or class.
Group of answer choices
Variable
Keywords
Constants
Identifiers
Identifiers
Which of the following can be considered as a valid identifier?
Group of answer choices
Final_Grade
First Name
$Area
123Height
Final_Grade
Consider the following statements:
int x = 22,y=15;
x = (x>y) ? (x+y) : (x-y);
What will be the value of x after executing these statements?
Group of answer choices
7
Error. Cannot be executed
22
37
37
All variables must be declared before it will be used. Which of the following is a correct
declaration of variables?
Group of answer choices
char opt 1;
float Wt, Ht;
float Vol; A;
int x,y
float Wt, Ht;
What value is placed in var? var = 12 > 9 ? 0 : 1;
Group of answer choices
1
9
12
0
0
Which of the following is NOT a primitive data type in C++ programming?
Group of answer choices
int
char
float
string
string
Identify what part of the structure of C++ program is the bold and underlined text.
/* this solves the area of a circle
you need to enter the radius as input
and it displays the area*/
#include<iostream>
#define PI 3.14159
using namespace std;
int main( )
{
float r, area;
cout<<”Enter radius:”;
cin>>r;
area= PI*r*r;
cout<<”\nThe sum of” << x << “and” << y << “is” << sum;
getch( );
return 0;
}</iostream>
Group of answer choices
main() function
Preprocessor directive
Statement
Comment
Preprocessor directive.
The symbol used in a preprocessor directive.
Group of answer choices
Colon(:)
Semicolon (;)
Comma (,)
Sharp sign(#)
Sharp sign(#)
Identify what part of the structure of C++ program is the bold and underlined text.
//this gets the sum of two numbers
#include<iostream>
#include<conio.h>
using namespace std;
int main( )
{
int a, b, sum;
cout<<”Enter two numbers:”;
cin>>a >> b;
sum= a+b;
cout<<”\nThe sum of” << x << “and” << y << “is” << sum;
getch( );
return 0;
}</conio.h></iostream>
Group of answer choices
main() function
Statement
Comment
Preprocessor directive
main() function
define g ‘9.8’
Which of the following demonstrates the correct use of #define directive if I want to assign 9.8 as gravitational acceleration constant?Note: Use g to represent gravitational acceleration constant
Group of answer choices
define g 9.8
The code “#include <iostream>" is an example of what part of a C++ program?
Group of answer choices</iostream>
Statement
Comment
Preprocessor directive
main() function
Preprocessor directive
include <iomanip> instructs the preprocessor to include a section of standard C++ code allowing to perform standard input and output operations</iomanip>
Group of answer choices
True
False
False
main() is an exit point of all the function where program execution begins.
Group of answer choices
True
False
True
Namespace std contains all the classes, objects and functions of the standard C++ library.
Group of answer choices
True
False
True
Consider the following program snippet. What will be the output?
int A = 1, B = 2, C = 3, X = 4, Y = 5, Z = 6; A++; B--; --C; X = Y++ + --Z; cout << B++ - --C;
Group of answer choices
8
1
9
0
0
The operator used to divide two numbers and returns only the remainder.
Group of answer choices
\
//
/
%
%
True or False: (a!=4) || !(b>c) where a=1, b=2, c=0
Group of answer choices
True
False
Cannot be determined
True
All are arithmetic operators, except ______
Group of answer choices
!=
*
%
+
The special character that indicates a string constant in a Turbo C++ program.
Group of answer choices
” “
/* */
’ ‘
/ /
” “
Let a = 10. What will be the value of a after the following expression a -= 5; is executed?
Group of answer choices
1
0
10
5
5
Primitive data types are built-in that can be used directly by the user to declare variables.
Group of answer choices
True
False
True
It is an operator used to alter the value of a variable
Group of answer choices
=
<=
==
!=
=
Which of the following is not true about C++?
Group of answer choices
It is interpreted.
It is statically typed.
It is general-purpose programming language.
It is a free-form programming language.
It is interpreted.
The following statements about int main() function is TRUE except ________.
Group of answer choices
All C++ programs should have a main function.
The execution of all C++ programs begins with the main function
Semicolon is required at the end of this statement.
The function needs to return some integer at the end of the execution.
Semicolon is required at the end of this statement.
Statically typed is a programming language characteristic in which variable types are explicitly declared.
Group of answer choices
True
False
True
Given the declaration int num=5; Which of the following is the other way to initialize variables?
Group of answer choices
int 5=num;
int num 5;
int num(5);
int num[5];
int num(5);
The expression x += y is the same as ______.
Group of answer choices
x =+ y
x == +y
x = x + y
y += x
It is an operator used to alter the value of a variable
Group of answer choices
=
==
!=
<=
=
A global may be used in any part of the program.
Group of answer choices
True
False
True
It is a named location in memory that is used to hold a value that may be modified by the program.
Group of answer choices
Identifiers
Constants
Tokens
Variable
Variable
Which statement makes sure that x is an even number?
Group of answer choices
x = x%2 == 0 ? x+1 : x;
x = x%2 == 1 ? x++ : x;
x += x%2 == 0 ? 0 : 1 ;
x += 2*x ;
x += x%2 == 0 ? 0 : 1 ;
C++ was developed by Bjarne Stroustrup as an enhancement to what programming language?
Group of answer choices
Pascal
B language
C language
BASIC
C language
The backslash constant that represents a new line.
Group of answer choices
\t
\r
\n
\
\n
Blank lines have effect on a C++ program because they improve readability of the code.
Group of answer choices
True
False
True
Returning 0 when we run a C++ program indicates that our program has not run successfully.
Group of answer choices
True
False
False