1/33
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Who developed the C programming language?
Dennis M. Ritchie
When was C first implemented?
1972
Why is C widely used? Select all that apply.
It can handle low-level activities
Structured language
Easy to learn
It can be compiled on a variety of computer platforms
Which language is C the successor of?
B
C runs nearly as fast as which other language?
Assembly language
What is the file extension of a C language source code file?
.c
What tools are required to set up an environment in order to write, compile, and run a program written in the C language? Select all that apply.
Text editor
C compiler
What type of file contains the source code?
source files
What is source code compiled into?
machine language
Match the parts of the program with its definition.
-----------------------------------------------------------------
#include <stdio.h>
int main()
{
/* my first program in C */
printf("Hello, World! \n");
return 0;
}
#include <stdio.h> : preprocessor command
int main(): the main function where the programs execution begins
/* my first program in C */ : comments
printf("Hello, World! \n"); : function available in C
return 0; : terminates the main() functions
Given the source code below, how many tokens make up the statement?
printf("Hello COP 3223!");
5
In a C program, an individual statement must be ended with a semicolon.
True
There are multiple formats of an acceptable comment in C, select all that apply.
/* comment */
// comment
Regarding identifiers for variables, functions, or any other user-defined item, which of the following are acceptable? Select all that apply.
_variable
var23iable
variable
VARIABLE
Regarding keywords in the C programming language and creating identifiers. Keywords are reserved in all lowercase AND all uppercase.
False
Regarding whitespace in the C programming language, spaces are required between the operators in the following source code in order to compile, run, and provide the correct output.
int sum=2+3/2-12*15;
False
Match the data type to its definition.
Basic Types
Enumerated types
void
Derived types
Aggregate types
Basic Types: Arithmetic types are further classified into integer and floating point types.
Enumerated types: Used to define variables that can only assign certain discrete integer values.
void: No value is available
Derived types: pointer, array, structure, union, Function types
Aggregate types: array and structure
What C operator is used to yield the storage size of the object or type in bytes?
sizeof(type)
Given the three situations the void type is used in C, match the associated code with the situation.
Function returns as void: void exit (int status);
Function arguments as void: int rand(void);
Pointers to void: void*malloc( size_t size )
Which of the following is true regarding a variable in C? Select all that apply.
the data type determines the range of values that can be stored
the data type determines the set of operations that can be applied to the variable
the data type determines the layout of the variable's memory
has a specific type
the data type determines the size of the variable
Regarding basic data types in C, match the data type to its definition.
Char: typically one byte and is an integer
int: the most natural size of integer for the machine
float: a single precision floating point value
double: a double precision floating point value
void: represents the absences of type
A variable definition must include as a minimum which of the following? Select all that apply.
int variableName = 53;
Data type
Semi-colon
Valid name
Which of the following is true regarding variable definition in C? Select all that apply.
is useful when you are using multiple files
has its meaning at the time of compilation only
provides assurance to the compiler that there exists a variable with the given type and name
Constants can be altered during program execution.
False
Professional best practices state that when using constants in source code the syntax should be in which format?
upper case
Literals are not equivalent to fixed values in regard to computer programming in the C language.
False
Which of the following is the correct implementation for defining a constant as a macro?
#define RATE 25
When defining a constant as a macro where should it be located?
outside all functions
When defining a constant in the main() function, which of the following is the correction implementation?
const int LENGTH = 10;
What does a storage class define regarding variables?
scope
life-time
visibility
Match the storage class to its definition.
auto
register
static
extern
auto: is the default storage class for all local variables
register: to define local variables that should be stored in a register instead of RAM
static: instructs the compiler to keep a local variable in existence during the life-time of the program
extern: to give a reference of a global variable that is visible to ALL the program files
Match the operator to its functionality.
+
*
%
--
==
+: adds two operands
*: multiplies two operands
%: remainder after integer division
--: decrements integer by one
==: checks if two operands are equal
Match the operator to its functionality.
>=
!=
!
||
&
>=: checks if left operand is greater than or equal to the right operand
!=: checks if two operands are not equal
!: used to reverse the logical state of its operand
||: if any of the two operands is non-zero, then the condition becomes true
&: bitwise AND
Match the operator to its functionality.
=
/=
sizeof()
?:
-=
=: assigns values from right side operands to left side operand
/=: it divides the left operand with the right operand and assigns the result to the left operand
sizeof(): returns the size of a variable
?:- conditional expression; if condition is true ? then value X : otherwise value Y
-=: it subtracts the right operand from the left operand and assigns the result to the left operand