wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.
How do you write an if statement?
a)
if ()
b)
als ()
c)
else ()
d)
else if ()
2.
Which for loop is correct?
a)
for (1; x < 5; i--)
b)
for(x; 5; ++1)
c)
for(int i = 0; i < 5; i++)
d)
for(int i = 0, i < 5, i++)
3.
Which while loop is correct?
a)
while (true) { }
b)
while true { }
c)
continue (true) { }
d)
while (1)
4.
Which one will return an value?
a)
give 1;
b)
rerun 2;
c)
*a = 1;
d)
return 1;
5.
How do you invoke a function?
a)
function { };
b)
function[x];
c)
function();
d)
(function);
6.
What does this give?  int a[2] = { 1, 5 }; int *p; p = a; p++;
a)
*p = 1
b)
p = 1
c)
*p = 5
d)
p = 5
7.
What is a correct array?
a)
int a() = { 1, 2 };
b)
int a{} = [ 1, 2 ];
c)
int a = ( 1, 2 );
d)
int a[2] = { 1, 2 };
8.
Which type is incorrect?
a)
int
b)
double
c)
float
d)
array
9.
Which one is a function prototype?
a)
void function ();
b)
function ();
c)
void function [];
d)
() function { };
10.
Which function is correct?
a)

void function () { }

b)

function [] { }

c)
function ( { } )
d)
void function [ ] ( )