FA3 Flashcards

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

A

define g 9.8

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

A

False

24
Q

main() is an exit point of all the function where program execution begins.
Group of answer choices

True

False

A

True

25
Q

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

True

False

A

True

26
Q

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

A

0

27
Q

The operator used to divide two numbers and returns only the remainder.
Group of answer choices

\

//

/

%

A

%

28
Q

True or False: (a!=4) || !(b>c) where a=1, b=2, c=0
Group of answer choices

True

False

Cannot be determined

A

True

29
Q

All are arithmetic operators, except ______
Group of answer choices

!=

*

%

+

A
30
Q

The special character that indicates a string constant in a Turbo C++ program.
Group of answer choices

” “

/* */

’ ‘

/ /

A

” “

31
Q

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

A

5

32
Q

Primitive data types are built-in that can be used directly by the user to declare variables.
Group of answer choices

True

False

A

True

33
Q

It is an operator used to alter the value of a variable
Group of answer choices

=

<=

==

!=

A

=

34
Q

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.

A

It is interpreted.

35
Q

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.

A

Semicolon is required at the end of this statement.

36
Q

Statically typed is a programming language characteristic in which variable types are explicitly declared.
Group of answer choices

True

False

A

True

37
Q

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

A

int num(5);

38
Q

The expression x += y is the same as ______.
Group of answer choices

x =+ y

x == +y

x = x + y

y += x

A
39
Q

It is an operator used to alter the value of a variable
Group of answer choices

=

==

!=

<=

A

=

40
Q

A global may be used in any part of the program.
Group of answer choices

True

False

A

True

41
Q

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

A

Variable

42
Q

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 ;

A

x += x%2 == 0 ? 0 : 1 ;

43
Q

C++ was developed by Bjarne Stroustrup as an enhancement to what programming language?
Group of answer choices

Pascal

B language

C language

BASIC

A

C language

44
Q

The backslash constant that represents a new line.
Group of answer choices

\t

\r

\n

\

A

\n

45
Q

Blank lines have effect on a C++ program because they improve readability of the code.
Group of answer choices

True

False

A

True

46
Q

Returning 0 when we run a C++ program indicates that our program has not run successfully.
Group of answer choices

True

False

A

False