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
Q

At what time does a variable definition have its meaning?

A

compilation time

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

extern keyword

A

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.

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

Two types of C expressions

A

lvalue and Rvalue

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

lvalue

A

Expressions that refer to a memory location; can be on left side or right side

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

rvalue

A

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.

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

fixed values that the program may not alter during its execution

A

constants a.k.a literals; values cannot be modified after their definition.

31
Q

Four storage classes

A

auto, register. static, extern

32
Q

default storage class for all local variables

A

auto

33
Q

‘auto’ storage class. can only be used…

A

within functions, i.e., local variables.

34
Q

storage class used to define local variables that should be stored in a register instead of RAM

A

register

35
Q

What does the register storage class mean?

A

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
Q

Does using the register storage class mean that the variable will DEFINATELY be stored in the register?

A

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
Q

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.

A

static; Therefore, making local variables static allows them to maintain their values between function calls.

38
Q

What happens when the static modifier is applied to global variables?

A

it causes that variable’s scope to be restricted to the file in which it is declared.

39
Q

storage class that causes only one copy of that member to be shared by all the objects of its class.

A

static

40
Q

storage class used to give a reference of a global variable that is visible to ALL the program files

A

extern

41
Q

storage class where the variable cannot be initialized

A

extern

42
Q

storage class which points the variable name at a storage location that has been previously defined

A

extern

43
Q

The header file stdio.h stands for

A

Standard Input Output. It has the information related to input/output functions.

44
Q

The header file stdlib.h stands

A

for Standard Library. It has the information of memory allocation/freeing functions.

45
Q

a symbol that tells the compiler to perform specific mathematical or logical functions

A

operator

46
Q

types of operators

A

Arithmetic, Relational, Logical, Bitwise. Assignment

Misc

47
Q

By default, C uses call by _____ to pass arguments.

A

value

48
Q

a kind of data structure that can store a fixed-size sequential collection of elements of the same type

A

array

49
Q

All arrays consist of _ memory locations

A

contiguous

50
Q

C programming does not allow to return an entire array as an argument to a function. However, you can return a _______ by _________.

A

pointer to an array; specifying the array’s name without an index.

51
Q

pointer

A

a variable whose value is the address of another variable

52
Q

The actual data type of the value of all pointers, whether integer, float, character, or otherwise

A

a long hexadecimal number that represents a memory address

53
Q

The only difference between pointers of different data types is

A

the data type of the variable or constant that the pointer points to

54
Q

A pointer that is assigned NULL

A

a null pointer

55
Q

In several standard libraries, The NULL pointer is a constant with a value of

A

zero

56
Q

In most of the operating systems, programs are not permitted to access memory at address

A

0

57
Q

A variable that is a pointer to a pointer must be declared as such. This is done by ______.

A

placing an additional asterisk in front of its name

58
Q

There are four arithmetic operators that can be used on pointers:

A

++, –, +, and -

59
Q

string

A

one-dimensional array of characters terminated by a null character ‘\0’

60
Q

Why is the size of a character array containing a string is one more than the number of characters?

A

To hold the null character at the end of the array

61
Q

used to represent a record and to combine data items of different kinds

A

structures

62
Q

a union

A

a special data type available in C that allows to store different data types in the same memory location

63
Q

You can define a union with many members, but ____.

A

only one member can contain a value at any given time

64
Q

bit fields

A

the variables defined with a predefined width

65
Q

a keyword which you can use to give a type a new name

A

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
Q

difference between typedef and #define

A

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
Q

C programming treats all the devices as

A

files

68
Q

reads the next available character from the screen and returns it as an integer

A

getChar(void); This function reads only single character at a time

69
Q

puts the passed character on the screen and returns the same character.

A

putChar(int c); This function puts only single character at a time.

70
Q

reads a line from stdin into the buffer pointed to by s until either a terminating newline or EOF (End of File).

A

char *fgets(char *s)

71
Q

writes the string ‘s’ and ‘a’ trailing newline to stdout.

A

int puts(const char *s)

72
Q

function reads the input from the standard input stream stdin and scans that input according to the format provided.

A

int scanf(const char *format, …)

73
Q

function writes the output to the standard output stream stdout and produces the output according to the format provided

A

int printf(const char *format, …)