FA3 Flashcards

(47 cards)

1
Q

All lines beginning with two slash signs (//) do have any effect on the behavior of the program.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

C++ is not case-sensitive programming language.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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”;

A

preprocessor directive such as #define FALSE 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

It is a low-level language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following symbols is best used to make a 20-line statements as block comment?
Group of answer choices

/* */

??

//

A

/* */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Namespace std contains all the classes, objects and functions of the standard C++ library.
Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

All C++ statements that need to be executed are written within main ( ).
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The symbols that indicates the beginning of main’s function definition.
Group of answer choices

}

{

<>

#

A

{

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

These are names that are given to various elements of a program created by the program.
Group of answer choices

Tokens

Identifiers

Constants

Keywords

A

Identifiers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

An operator that is also called ternary operator.
Group of answer choices

Conditional Operator

Increment Operator

Triad Operator

Modulo Operator

A

Conditional Operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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.

A

Special characters are allowed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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

A

Identifiers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following can be considered as a valid identifier?
Group of answer choices

Final_Grade

First Name

$Area

123Height

A

Final_Grade

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

37

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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

A

float Wt, Ht;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What value is placed in var? var = 12 > 9 ? 0 : 1;
Group of answer choices

1

9

12

0

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which of the following is NOT a primitive data type in C++ programming?
Group of answer choices

int

char

float

string

A

string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

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

A

Preprocessor directive.

19
Q

The symbol used in a preprocessor directive.
Group of answer choices

Colon(:)

Semicolon (;)

Comma (,)

Sharp sign(#)

A

Sharp sign(#)

20
Q

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

A

main() function

21
Q

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

22
Q

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

A

Preprocessor directive

23
Q

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

24
main() is an exit point of all the function where program execution begins. Group of answer choices True False
True
25
Namespace std contains all the classes, objects and functions of the standard C++ library. Group of answer choices True False
True
26
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
27
The operator used to divide two numbers and returns only the remainder. Group of answer choices \ // / %
%
28
True or False: (a!=4) || !(b>c) where a=1, b=2, c=0 Group of answer choices True False Cannot be determined
True
29
All are arithmetic operators, except ______ Group of answer choices != * % +
30
The special character that indicates a string constant in a Turbo C++ program. Group of answer choices " " /* */ ' ' / /
" "
31
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
32
Primitive data types are built-in that can be used directly by the user to declare variables. Group of answer choices True False
True
33
It is an operator used to alter the value of a variable Group of answer choices = <= == !=
=
34
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.
35
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.
36
Statically typed is a programming language characteristic in which variable types are explicitly declared. Group of answer choices True False
True
37
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);
38
The expression x += y is the same as ______. Group of answer choices x =+ y x == +y x = x + y y += x
39
It is an operator used to alter the value of a variable Group of answer choices = == != <=
=
40
A global may be used in any part of the program. Group of answer choices True False
True
41
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
42
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 ;
43
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
44
The backslash constant that represents a new line. Group of answer choices \t \r \n \\
\n
45
Blank lines have effect on a C++ program because they improve readability of the code. Group of answer choices True False
True
46
Returning 0 when we run a C++ program indicates that our program has not run successfully. Group of answer choices True False
False