COP 3223C Test 1 (Quizzes)
Which of the following is true regarding variable definition in C? - has its meaning at the time of compilation only - cannot declare a variable multiple times in a C program - is useful when you are using multiple files - provides assurance to the compiler that there exists a variable with the given type and name
- has its meaning at the time of compilation only - is useful when you are using multiple files - provides assurance to the compiler that there exists a variable with the given type and name
When was C first implemented?
1972
Definition of basic types
Arithmetic types and are further classified into integer and floating- point types
Who developed the C programming language?
Dennis M. Ritchie
Character literals are enclosed in double quotes. T/F
False
Regarding keywords in the C programming language and creating identifiers. Keywords are reserved in all lowercase and all uppercase. T/F
False
Definition of derived types
Pointer, Array, Structure, Union, Function Types
In a C program, an individual statement must be ended with a semicolon? T/F
True
Literals are equivalent to fixed values in regard to computer programming in the C language. T/F
True
String literals are enclosed in double quotes. T/F
True
Regarding basic data types in C, match the data type to its definition: float = - the most natural size of integer for the machine - a single precision floating point value - a double precision floating point value - typically one byte and in an integer type - represents the absence of a type
a single precision floating point value
printf("Hello, World!\n"); represents what in c programming
function available in c
Definition of void
no value is available
#include <stdio.h> represents what in c programming
preprocessor command
A variable definition must include as a minimum which of the following? - Semi-colon - Assignment operator - Valid name - Initial value - Data type
semi colon valid name data type
What C operator is used to yield the storage size of the object or type in bytes
sizeof()
What type of file contains the source code?
source files
return 0; represents what in c programming
terminates the main()
Regarding basic data types in C, match the data type to its definition: int = - the most natural size of integer for the machine - a single precision floating point value - a double precision floating point value - typically one byte and in an integer type - represents the absence of a type
the most natural size of integer for the machine
Definition of enumerated types
used to define variables that can only define certain discrete integer values
When defining a constant as a preprocessor command, which of the following is the correct implementation?
#define LENGTH 10
These are the multiple formats of an acceptable comment in C
- // comment - /* comment */
What tools are required to set up an environment in order to write, compile, and run a program written in the C language?
- C compiler - Text editor
Why is C widely used?
- Easy to learn - Structured language - It can be compiled on a variety of computer platforms - It can handle low-level activities
Which data types are valid regarding integer literals for constants?
- Hexadecimal - Decimal - Octal
Which of the following are the parts of a floating point constant?
- exponent part - fractional part - decimal point - integer part
Which of the following is true regarding a variable in C? - has a specific type - the data type determines how it can be named - the data type determines the set of operations that can be applied to the variable - the data type determines the size of the variable - all variables use four bytes of membor - the data type determines the range of values that can be stored - the data type determines the layout of the variable's memory
- has a specific type - the data type determines the set of operations that can be applied to the variable - the data type determines the size of the variable - the data type determines the range of values that can be stored - the data type determines the layout of the variables memory
What is the file extension of a C language source code file?
.c
Given the source code below, how many tokens make up the statement? printf("Hello COP 3223!");
5
Regarding identifiers for variables, functions, or any other user defined item, which of the following are acceptable? _variable VARIABLE variable $variable var23iable 2variable3
_variable VARIABLE variable var23iable
Regarding basic data types in C, match the data type to its definition: double = - the most natural size of integer for the machine - a single precision floating point value - a double precision floating point value - typically one byte and in an integer type - represents the absence of a type
a double precision floating point value
Regarding basic data types in C, match the data type to its definition: void = - the most natural size of integer for the machine - a single precision floating point value - a double precision floating point value - typically one byte and in an integer type - represents the absence of a type
represents the absence of a type
Regarding white space 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; T/F
False
C runs nearly as fast as which other language?
Assemble language
Which language is C the successor of?
B
Constants cannot be altered during program execution. T/F
True
Definition of aggregate types
array and structure types
Professional best practices state that when using constants in source code the syntax should be in which format?
camelCase
/* my first program in C*/ represents what in c programming
comments
When defining a constant inside the main() function, which is the correct implementation?
const int LENGTH = 10;
Match the associated code with the situation : Function argument as void = -void exit (int status); -int rand(void); -void*malloc( size_t size );
int rand(void);
What is source code compiled into?
machine language
int main() represents what in c programming
the main function where the program execution begins
Regarding basic data types in C, match the data type to its definition: char = - the most natural size of integer for the machine - a single precision floating point value - a double precision floating point value - typically one byte and in an integer type - represents the absence of a type
typically one byte and in an integer type
Match the associated code with the situation : Function returns as void = -void exit (int status); -int rand(void); -void*malloc( size_t size );
void exit (int status);
Match the associated code with the situation : Pointers to void = -void exit (int status); -int rand(void); -void*malloc( size_t size );
void*malloc( size_t size );