NEW
Font size
WorksheetsStructured Programming
Total questions: 11
Worksheet time: 4mins
Which statement about global variables is TRUE?
They can be accessed in any function
They disappear after one function finishes
They can only be accessed in the main() function
They works just like local variable
What’s the main danger of using global variables?
They eat up all your RAM
Any function can change them
They leak your code to the internet automatically
They cannot store integers
In C, what’s the difference between <stdio.h> and "myLib.h"?
<stdio.h> is used for code indentation
They are exactly the same
< > is for built-in libraries, " " is for custom libraries
myLib.h makes your code compile 2x faster
What will this code output?
Nothing
C
Compilation error
20
Which of these functions can generate a random number?
rand()
printf("%d", luckyNum);
scanf("%d", &rand);
randomNumberPlease()
In a flowchart, which shape represents a decision?
Diamond
Rectangle
Oval
Triangle
What will this program print?
10
5
15
Both 5 and 10
error: expected ')' before '}' token
What would the output be?
HiHello
Undefined behavior
HelloHi
Hello
Hi Hello
Which library is needed to use bool in C?
<stdlib.h>
<stdbool>
<boolean.h>
<stdbool.h>
Which defines a proper global constant?
const float PI = 3.14;
float const = 3.14;
constant float PI = 3.14;
#define const PI = 3.14;
In structured programming, what is “selection”?
Running every line in sequence
Repeating blocks of code
Choosing between alternatives using conditions
Selecting your favorite IDE in lab class
