wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

P1 COMPROG 1-6

Total questions: 50

Worksheet time: 36mins

Name
Class
Date
1.
What symbol do flowcharts begin with?
a)
oval
b)
parallelogram
c)
rectangle
d)
diamond
2.
What symbol do flowcharts end with?
a)
oval
b)
parallelogram
c)
rectangle
d)
diamond
3.
What symbol shows a decision?
a)
oval
b)
parallelogram
c)
rectangle
d)
diamond
4.

What symbol shows something you need to do/process?

a)

oval

b)

parallelogram

c)

rectangle

d)

diamond

5.

Which symbol shows an input?

a)

oval

b)

parallelogram

c)

rectangle

d)

diamond

6.

Why do we use flowcharts?

a)

To represent and plan algorithms in an easy way

b)

To use different mathematical shapes

c)

The computer can read them

d)

It's more complicated

7.

What is the name of this symbol in a flowchart?

a)

Input

b)

Output

c)

Decision/Question

d)

Process

8.

What is the name of this symbol in a flowchart?

a)

Input/Output

b)

Decision

c)

Process

d)

Start/Stop

9.
What is the purpose of an arrow in a flowchart?
a)
Shows the relationships between shapes/ the flow of information
b)
They look nice when we use them
c)
We don't use arrows
d)
Shows the way the arrow is directed
10.
Which data type is used to store:
100
a)
Integer
b)
Double
c)
Boolean
d)
String
11.
Which data type is used to store:
TRUE
a)
Boolean
b)
Double
c)
String
d)
Integer
12.
This data type is used to store whole numbers
a)
Integer
b)
Double
c)
Boolean
d)
String
13.
This data type is used to store a mixture of letters and numbers and symbols.
a)
String
b)
Character
c)
Boolean
d)
Integer
14.

What is a variable?

a)

A storage location of memory which can change

b)

A random area to store things in.

c)

Something that changes

d)

Something that can only store numbers

15.

What is a Constant?

a)

A storage location of memory which does not change

b)

A random area to store things in.

c)

Something that changes

d)

Something that can only store numbers

16.
What is used to connect the flowchart symbols together?
a)
Rectangles
b)
Lines
c)
Arrows
d)
Patterns
17.

What is the output of C Program.?

int main()

{

int a=25;

while(a <= 27)

{

printf("%d ", a);

a++;

}

return 0;

}

a)

25 25 25

b)

25 26 27

c)

27 27 27

d)

Compiler error

18.

Which library is used for input output in C++?

a)

<stdio.h>

b)

<stdlib.h>

c)

<iostream.h>

d)

<math.h>

19.
The process of creating a new variable without value
a)
declaration
b)
naming
c)
instantiation
d)
assigning
20.
Which command moves the shown text to the next line?
a)
\t
b)
\n
c)
\r
d)
\s
21.
What is the output of this program?
Program
int main()
{
cout<<"Hi everybody";
return 0;
}
a)
"Hi everybody"
b)
Hi everybody"
c)
Hi everybody
d)
"Hi everybody
22.

If originally x=2,y=0, and z=1, what is the value of x, y, and z after executing the following code?


if (x>y)


y=x;

else

z=x;

a)

x=2 y=2 z=1

b)

x=0 y=2 z=0

c)

x=2 y=1 z=1

d)

x=2 y=0 z=1

23.
a)

0

b)

5

c)

-5

d)

10

e)

-10

24.

A function can have _____ inside the parenthesis

a)

loops

b)

Arguments/Parameters

c)

Braces

d)

Types

25.

A function that has no return type starts with:

a)

int

b)

void

c)

Arguments

d)

Braces

26.

What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

-> and <-

c)

BEGIN and END

d)

( and )

27.

Which of the following is a correct comment?

a)

*/ Comments */

b)

** Comment **

c)

/* Comment */

d)

{ Comment }

28.
... variables store whole numbers (-4, 3, 51, etc). 
a)
Float
b)
Logical
c)
Character
d)
Integer
29.

What does <= mean?

a)

less than

b)

greater than

c)

less than or equal to

d)

greater than or equal to

30.

What is the only function all C++ programs must contain?

a)

cout()

b)

system()

c)

main()

d)

program()

31.

What punctuation is used to signal the beginning and end of code blocks?

a)

{ }

b)

//

c)

BEGIN and END

d)

/* */

32.

After running the following code, what will be the value of x?

y = 3;

x = 5 * (++y);

a)

15

b)

5

c)

15

d)

20

33.

Voids

a)

A statement that returns a value

b)

A statement that doesn't return a value

c)

A function that return a value

d)

A function that doesn't return a value

34.

Which one is NOT the keywords for data type?

a)

bool

b)

loop

c)

double

d)

char

35.

What is the function of endl ?

a)

print statement

b)

erase line

c)

create new line

d)

store value

36.

Which one is the example of the data types int?

a)

A

b)

28.02

c)

19

d)

aliya@yahoo.com

37.

What is the output for this program?

a)

5

b)

0

c)

20

d)

3

38.

True/False: For Loops can never be an infinite loop.

a)

True

b)

False

c)

Waluigi is my Spirit Animal

d)

Mr. G didn't feel like deleting the two extra options

39.

iostream

a)

Displays output from the screen and input from the keyboard

b)

Has all the math equations

c)

Counts the time

d)

Checks if the code has a function

40.

#include<stdio.h>

int main()

{

float a=0.7;

if(a<0.7)

{

printf("C");

}

else

{

printf("C++");

}

}

a)

C

b)

C++

c)

Compilation Error

d)

None of the these

41.

#include<stdio.h>

int main ()

{

int x = 1, y = 2, z = 3;


z = x + y;

y = z - y;

x = z + y;


printf ("n%d %d %d", x, y, z);

}

a)

4 1 3

b)

3 1 4

c)

1 2 3

d)

3 2 1

42.

#include<stdio.h>

int main() {


int x = 0;


if(x = 0)

printf("It is zero");

else

printf("It is not zero");

}

a)

It is zero

b)

Run time error

c)

It is not zero

d)

None

43.

#include statement must be written _______________

a)

Before any scanf() / printf()

b)

It can be written anywhere

c)

Before main()

d)

After main()

44.

What is the type of the temp variable?

var temp = 14.55;

a)

Double

b)

Boolean

c)

Integer

d)

String

45.

What is the output of this code?

int x = 16;

int y = 5;

Console.WriteLine(x/y);

a)

3.2

b)

3

c)

error

d)

4

46.

Which operator is used to determine the remainder?

a)

*

b)

%

c)

+

d)

-

47.

Every statement in a C program should end with a -------------

a)

Colon(:)

b)

semicolon(;)

c)

comma(,)

d)

fullstop(.)

48.

The symbol of a new line character is -----------------------

a)

\n

b)

\t

c)

\d

d)

\f

49.

What type of data would your name be?

a)

Real

b)

Boolean

c)

Integer

d)

String

50.

Which of the following is a relational operator?

a)

+

b)

-

c)

/

d)

>