Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
22 Cards in this Set
- Front
- Back
In a C program, how are comments indicated?
|
You can use the following
/* Comment Here */ or // Comment here |
|
Is the following a valid comment string from a C program:
/* indicates the program end /* |
No the the end of the comment should be */
|
|
How are lines in a C program that are going to be processed by the preprocessor indicated?
|
Lines that begin with a #
|
|
What does the following line of C code do:
#include <stdio.h> |
Its a directive to the C preprocessor to include the contents of the standard input/standard output header in the program
|
|
A C program can contain many functions, one of which must be ___________
|
main
|
|
In C, how do you begin and end each function?
|
With the left and right braces
{ } |
|
In C, a statement ends with a semicolon (;). What is the term for the semicolon?
|
statement terminator
|
|
What does the following C statement do:
printf( "Welcome to C!\n" ); |
It will print Welcome to C! and move the cursor to the next line.
|
|
Describe the following escape sequences:
\n \t \a \\ \" |
\n - Newline, moves the cursor to the beginning of the next line
\t - Horizontal tab \a - Alert, sounds a system bell \\ - backslash, insters a backlash character into a string \" - Double Quotes, insterts double quotes into a string |
|
When C program needs to make a "call" for a library function, such as printf, what knows where to find the library?
|
the linker
|
|
Find the mistake in the following C program:
#include <stdio.h> int main(void) printf( "Hello world!/n") return 0; } |
Its missing the left brace { before the beginning of the body and missing a semicolon ; at the end of the print statement.
|
|
Describe what a variable is:
|
A variable is a location in memory where a value can be stored for use by a program
|
|
Given the following line of code, the variable is of what type:
int a; |
a is an integer
|
|
What occurs when the compiler cannot recognize a statement?
|
syntax error
|
|
What is the function scanf used for?
|
reads standard input to obtain a value from the user
|
|
Given the following statement, which is the format control string?
scanf( "%d", &integer1 ); |
%d
it indicats the type of data that should be input by the user |
|
What is the purpose of the ampersand in the following statement:
scanf( "%d", &integer1 ); |
The amperasand (&) is called the address operator and provides scanf with the location in memory to store the data entered by the user
|
|
What is happening in the following C statement:
sum = integer1 + integer2; |
the variable sum is being given the value of integer1 and integer2 added together
|
|
Given the following printf statement, what be the value printed to the screen for %d:
printf( "Sum is %d\n", integer1 + integer2 ); |
%d would be the whatever the sum of integer1 and integer2 is
|
|
Given the following C program what will be the value of i when it is printed
#include <stdio.h> int main(void) { int i = 0; int a = 5; int b = 10; i = (a * a) + b; printf ( "%d\n", i); return 0; } |
35
|
|
Given the following C program what will be the value of i when it is printed
int main(void) { int i = 0; int a = 5; int b = 10; i = a * a + b / a; printf ( "%d\n", i); return 0; } |
27
|
|
Given the following C program what will be the value of i when it is printed
int main(void) { int i = 0; int a = 5; int b = 17; i = b % a; printf ( "%d\n", i); return 0; } |
2
|