wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CC 101 Final Exam

Total questions: 50

Worksheet time: 31mins

Name
Class
Date
1.

“Welcome” is a string constant.

a)

True

b)

False

2.

29.85 is an integer constant.

a)

True

b)

False

3.

1.2e+10 is a floating point constant.

a)

True

b)

False

4.

You_1 is a valid identifier.

a)

True

b)

False

5.

max temp is a valid identifier.

a)

True

b)

False

6.

In this logical operator, the result is true if both operands are true; it is false in all other cases.

a)

And

b)

Or

c)

Not

7.

Type the C language syntax/code: Assign the value of 8 to the variable abc.

(a)  

8.

Type the C language syntax/code: Declare an Integer variable hours and initialize to 40.

(a)  

9.

Type the C/C++ language syntax/code: Compute the value of speed equals to distance divided by time.

(a)  

10.

Type the C/C++ language syntax/code:

Using the const keyword, declare the double variable PESO as constant value of 40.5.

(a)  

11.

In C++, this declaration allows all elements in the std namespace to be accessed in an unqualified manner (without the std:: prefix).

a)

using namespace std;

b)

namespace using std;

c)

using std nameSpace;

12.

What will be the output onscreen for this codes:

int age = 20;

int zcode = 1410;

cout << "I am " << age << "years old and my zip code is " << zcode;

(a)  

13.

Another way to write this variable declaration and initialization in C++:

int num2 = 26;

(a)  

14.

Type the C++ language syntax/code: Input value to integer variable i.

(a)  

15.

In C language:

If rate = 15, what is printed by printf("rate\n");

a)

15

b)

rate

16.

The variable has the following characteristics (check all that apply)

a)

name

b)

value

c)

data type

d)

initial value

17.

Is this declaration valid?

int j = “PQ”;

a)

True

b)

False

18.

Is this declaration valid?

float p, q=0, r;

a)

True

b)

False

19.

The operator precedence decides:

a)

which operator is used first

b)

which operator is not to be used

c)

which operator is the fastest

20.

In this mathematical expression:

3 * 5 + (8 + 3) / 5;

which of the following will be executed first?

a)

3 * 5

b)

8 + 3

21.

25 % 3 evaluates to :

a)

8.33

b)

8

c)

1

d)

.33

22.

Which are comparative operators? (check all that apply)

a)

<=

b)

>=

c)

=

d)

!=

23.

Given the following C++ codes, what will be printed onscreen?

int myVar = 7;

if (myVar>=0 && myVar<7)

cout << "OK";

else

cout << "Cancel";

a)

OK

b)

Cancel

24.

The following are integral data type except -

a)

integer

b)

character

c)

float

25.

Which of the following is invalid variable declaration in C/C++?

a)

float fee=100;

b)

int a;

c)

double k, g=3.4;

d)

char in=y;

26.

What function reads data from the keyboard in C?

a)

displayf()

b)

printf()

c)

read()

d)

scanf()

27.

What data type represents only two values – nonzero number for True and zero for False?

(a)  

28.

In C, which of the following is a correct declaration for a string of character type?

a)

char[20] name;

b)

char name[20];

c)

char name=”bsit”;

d)

char name(20);

29.

It executed whenever none of the other case values match the value in the switch expression

a)

break;

b)

default

c)

switch

d)

case

30.

Which of the following conversion code / format specifier is used to read or write an integer data type?

a)

%c

b)

%d

c)

%f

d)

%s

31.

In C, what is the symbol of the address operator that can be added at the beginning of the variable to match the variable’s type to the conversion specification type?

a)

& (ampersand)

b)

@ (at sign)

c)

% (percent)

d)

# (pound sign)

32.

What is the meaning of the header file <stdio.h>?

a)

Stacked Input/Output

b)

Standard Input/Output

c)

Stated Input/Output

d)

Steady Input/Output

33.

Which of the following is the correct syntax to declare a PI as defined constant?

a)

#define PI 3.1416

b)

#define PI = 3.1416

c)

#define PI as 3.1416

d)

#define PI to 3.1416

34.

Which of the following describes a positive logic of multi-way decision?

a)

If the result is true, execute the statement(s). No else part, the false branch always goes to the next IF statement.

b)

If the result is true, execute the statement(s). If the result is false, execute the next IF condition until the resultant is true.

c)

If the result is true, execute the statement(s), else, a different statement(s) are/is executed.

35.

Which is invalid for this precision modifier %4.2f?

a)

10.99

b)

200.00

c)

1000.50

d)

50000.75

36.

What is the backslash character for horizontal tab (5 spacebar press) ?

(a)  

37.

This table shows logical relationships and lists the values that each operand can assume and the resulting value.

a)

If Else Table

b)

Logical Table

c)

Pseudo Table

d)

Truth Table

38.

The main() function always starts and terminates with these special characters.

a)

[

]

b)

{

}

c)

<

>

39.

A logical operator that changes a true value to false and a false value to true

a)

&& (And)

b)

== (Equal)

c)

! (Not)

d)

|| (Or)

40.

Which of the following Boolean expressions has the resulting value of True?

a)

! True

b)

False && True

c)

True || False

d)

False || False

41.

if...else() is an example of which logic structure?

a)

one-way decision

b)

two-way decision

c)

multi-way decision

42.

It causes the program to jump out of the switch statement

a)

break

b)

case

c)

default

43.

Which two case labels are valid?

a)

case 10:

b)

case 10.75:

c)

case 'g':

d)

case >21:

44.

Given the following C syntax, what is the output on screen?

int month = 8;

switch (month) {

case 6: printf("June");

case 7: printf("July ");

case 8: printf("August ");

case 9: printf("September ");

case 12: printf("December ");

break;

default: printf("Invalid”);

break;

}

a)

August

b)

August September December

c)

December

d)

Invalid

45.

Another decision making structure in C/C++ aside from if, if…else, and if…else if

a)

do...while

b)

for

c)

switch...case

d)

while

46.

Click all examples of C/C++ compiler and IDE for desktop

a)

CodeBlocks

b)

CC386

c)

MinGW

d)

Notepad

47.

What is the filename extension of C++ program?

a)

.c

b)

.c++

c)

.cpp

48.

Which is a line comment?

a)

/ This is a whole line comment

b)

// This is a whole line comment

c)

** This is a whole line comment

49.

What is missing in these C++ codes to input string of characters?

string name, team

cout << "What's your name? ";

__________ (cin, name);

a)

getline

b)

get

c)

getlines

50.

A manipulator that can also be used to break lines aside from \n

(a)