Font size
WorksheetsP1 COMPROG 1-6
Total questions: 50
Worksheet time: 36mins
What symbol shows something you need to do/process?
oval
parallelogram
rectangle
diamond
Which symbol shows an input?
oval
parallelogram
rectangle
diamond
Why do we use flowcharts?
To represent and plan algorithms in an easy way
To use different mathematical shapes
The computer can read them
It's more complicated
What is the name of this symbol in a flowchart?
Input
Output
Decision/Question
Process
What is the name of this symbol in a flowchart?
Input/Output
Decision
Process
Start/Stop
100
TRUE
What is a variable?
A storage location of memory which can change
A random area to store things in.
Something that changes
Something that can only store numbers
What is a Constant?
A storage location of memory which does not change
A random area to store things in.
Something that changes
Something that can only store numbers
What is the output of C Program.?
int main()
{
int a=25;
while(a <= 27)
{
printf("%d ", a);
a++;
}
return 0;
}
25 25 25
25 26 27
27 27 27
Compiler error
Which library is used for input output in C++?
<stdio.h>
<stdlib.h>
<iostream.h>
<math.h>
Program
int main()
{
cout<<"Hi everybody";
return 0;
}
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;
x=2 y=2 z=1
x=0 y=2 z=0
x=2 y=1 z=1
x=2 y=0 z=1
0
5
-5
10
-10
A function can have _____ inside the parenthesis
loops
Arguments/Parameters
Braces
Types
A function that has no return type starts with:
int
void
Arguments
Braces
What punctuation is used to signal the beginning and end of code blocks?
{ }
-> and <-
BEGIN and END
( and )
Which of the following is a correct comment?
*/ Comments */
** Comment **
/* Comment */
{ Comment }
What does <= mean?
less than
greater than
less than or equal to
greater than or equal to
What is the only function all C++ programs must contain?
cout()
system()
main()
program()
What punctuation is used to signal the beginning and end of code blocks?
{ }
//
BEGIN and END
/* */
After running the following code, what will be the value of x?
y = 3;
x = 5 * (++y);
15
5
15
20
Voids
A statement that returns a value
A statement that doesn't return a value
A function that return a value
A function that doesn't return a value
Which one is NOT the keywords for data type?
bool
loop
double
char
What is the function of endl ?
print statement
erase line
create new line
store value
Which one is the example of the data types int?
A
28.02
19
aliya@yahoo.com
What is the output for this program?
5
0
20
3
True/False: For Loops can never be an infinite loop.
True
False
Waluigi is my Spirit Animal
Mr. G didn't feel like deleting the two extra options
iostream
Displays output from the screen and input from the keyboard
Has all the math equations
Counts the time
Checks if the code has a function
#include<stdio.h>
int main()
{
float a=0.7;
if(a<0.7)
{
printf("C");
}
else
{
printf("C++");
}
}
C
C++
Compilation Error
None of the these
#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);
}
4 1 3
3 1 4
1 2 3
3 2 1
#include<stdio.h>
int main() {
int x = 0;
if(x = 0)
printf("It is zero");
else
printf("It is not zero");
}
It is zero
Run time error
It is not zero
None
#include statement must be written _______________
Before any scanf() / printf()
It can be written anywhere
Before main()
After main()
What is the type of the temp variable?
var temp = 14.55;
Double
Boolean
Integer
String
What is the output of this code?
int x = 16;
int y = 5;
Console.WriteLine(x/y);
3.2
3
error
4
Which operator is used to determine the remainder?
*
%
+
-
Every statement in a C program should end with a -------------
Colon(:)
semicolon(;)
comma(,)
fullstop(.)
The symbol of a new line character is -----------------------
\n
\t
\d
\f
What type of data would your name be?
Real
Boolean
Integer
String
Which of the following is a relational operator?
+
-
/
>
