C Programming Language Flashcards

1
Q

tokens

A

A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

a statement terminator

A

semicolon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

each individual statement must be ended with

A

a semicolon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

a name used to identify a variable, function, or any other user-defined item

A

identifier

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

C does not allow _ within identifiers

A

punctuation characters such as @, $, and %

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Is C case-sensitive?

A

YES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A C compiler totally ignores __

A

A line containing only whitespace, possibly with a comment, a blank line,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Categories of types in C

A

basic, enumerated, void, derived

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

char (bytes, range)

A

1 byte, -128 to 127 or 0 to 255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

unsigned char (bytes, range)

A

1 byte, 0 to 255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

signed char (bytes, range)

A

1 byte, -128 to 127

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

int (bytes, range)

A

2 or 4 bytes, -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

unsigned int (bytes, range)

A

2 or 4 bytes, 0 to 65,535 or 0 to 4,294,967,295

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

short (bytes, range)

A

2 bytes, -32,768 to 32,767

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

unsigned short (bytes, range)

A

2 bytes, 0 to 65,535

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

long (bytes, range)

A

8 bytes or (4bytes for 32 bit OS) , -9223372036854775808 to 9223372036854775807

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

unsigned long (bytes, range)

A

8 bytes, 0 to 18446744073709551615

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

float (bytes, precision)

A

4 byte, 6 decimal places

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

double (bytes, precision)

A

8 byte, 15 decimal places

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

long double (bytes, precision)

A

19 decimal places

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

three situations for void

A

functions returning void, function arguments as void, pointers to void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

A pointer of type void * represents

A

the address of an object, but not its type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

what is a variable?

A

A variable is nothing but a name given to a storage area that our programs can manipulate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

basic types of variables

A

char, int, float, double, void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
At what time does a variable definition have its meaning?
compilation time
26
extern keyword
declare a variable at any place. Though you can declare a variable multiple times in your C program, it can be defined only once in a file, a function, or a block of code.
27
Two types of C expressions
lvalue and Rvalue
28
lvalue
Expressions that refer to a memory location; can be on left side or right side
29
rvalue
refers to a data value that is stored at some address in memory. An rvalue is an expression that cannot have a value assigned to it which means an rvalue may appear on the right-hand side but not on the left-hand side of an assignment.
30
fixed values that the program may not alter during its execution
constants a.k.a literals; values cannot be modified after their definition.
31
Four storage classes
auto, register. static, extern
32
default storage class for all local variables
auto
33
'auto' storage class. can only be used...
within functions, i.e., local variables.
34
storage class used to define local variables that should be stored in a register instead of RAM
register
35
What does the register storage class mean?
This means that the variable has a maximum size equal to the register size (usually one word) and can't have the unary '&' operator applied to it (as it does not have a memory location).
36
Does using the register storage class mean that the variable will DEFINATELY be stored in the register?
It should also be noted that defining 'register' does not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register depending on hardware and implementation restrictions.
37
storage class that instructs the compiler to keep a local variable in existence during the life-time of the program instead of creating and destroying it each time it comes into and goes out of scope.
static; Therefore, making local variables static allows them to maintain their values between function calls.
38
What happens when the static modifier is applied to global variables?
it causes that variable's scope to be restricted to the file in which it is declared.
39
storage class that causes only one copy of that member to be shared by all the objects of its class.
static
40
storage class used to give a reference of a global variable that is visible to ALL the program files
extern
41
storage class where the variable cannot be initialized
extern
42
storage class which points the variable name at a storage location that has been previously defined
extern
43
The header file stdio.h stands for
Standard Input Output. It has the information related to input/output functions.
44
The header file stdlib.h stands
for Standard Library. It has the information of memory allocation/freeing functions.
45
a symbol that tells the compiler to perform specific mathematical or logical functions
operator
46
types of operators
Arithmetic, Relational, Logical, Bitwise. Assignment | Misc
47
By default, C uses call by _____ to pass arguments.
value
48
a kind of data structure that can store a fixed-size sequential collection of elements of the same type
array
49
All arrays consist of _ memory locations
contiguous
50
C programming does not allow to return an entire array as an argument to a function. However, you can return a _______ by _________.
pointer to an array; specifying the array's name without an index.
51
pointer
a variable whose value is the address of another variable
52
The actual data type of the value of all pointers, whether integer, float, character, or otherwise
a long hexadecimal number that represents a memory address
53
The only difference between pointers of different data types is
the data type of the variable or constant that the pointer points to
54
A pointer that is assigned NULL
a null pointer
55
In several standard libraries, The NULL pointer is a constant with a value of
zero
56
In most of the operating systems, programs are not permitted to access memory at address
0
57
A variable that is a pointer to a pointer must be declared as such. This is done by ______.
placing an additional asterisk in front of its name
58
There are four arithmetic operators that can be used on pointers:
++, --, +, and -
59
string
one-dimensional array of characters terminated by a null character '\0'
60
Why is the size of a character array containing a string is one more than the number of characters?
To hold the null character at the end of the array
61
used to represent a record and to combine data items of different kinds
structures
62
a union
a special data type available in C that allows to store different data types in the same memory location
63
You can define a union with many members, but ____.
only one member can contain a value at any given time
64
bit fields
the variables defined with a predefined width
65
a keyword which you can use to give a type a new name
typedef; By convention, uppercase letters are used for these definitions to remind the user that the type name is really a symbolic abbreviation, but you can use lowercase
66
difference between typedef and #define
typedef is limited to giving symbolic names to types only where as #define can be used to define alias for values as well, q., you can define 1 as ONE etc. typedef interpretation is performed by the compiler whereas #define statements are processed by the pre-processor.
67
C programming treats all the devices as
files
68
reads the next available character from the screen and returns it as an integer
getChar(void); This function reads only single character at a time
69
puts the passed character on the screen and returns the same character.
putChar(int c); This function puts only single character at a time.
70
reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF (End of File).
char *fgets(char *s)
71
writes the string 's' and 'a' trailing newline to stdout.
int puts(const char *s)
72
function reads the input from the standard input stream stdin and scans that input according to the format provided.
int scanf(const char *format, ...)
73
function writes the output to the standard output stream stdout and produces the output according to the format provided
int printf(const char *format, ...)