C Standard Library Flashcards

1
Q

What is the C address of operator used for in the scanf() function

A

To allow the scanf function to store the input in a variable

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

What is the return value of the C printf() function

A

The number of characters it printed

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

C Function: strlen()

A

strlen() give the length of the string passed to it

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

How do you read a string from the keyboard using the C scanf() function

A

Call the function with the format string containing a %s specifier and the character array you want to save the string in but don’t use the &. for example: scanf(“ %s”, array_name);

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

What is the return value of the C scanf() function

A

The number of characters it successfully read

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

C Function: strcpy(string1, string2)

A

strcpy() copies the contents of string2 into string1

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

C Function: strcat(string1, string2)

A

strcat() concatenates the contents of string2 onto the end of string1

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

C Function: strcmp(string1, string2)

A

strcmp() compares string1 and string2 and returns 0 if string1 is the same as string2 or a non-zero value if they are both different

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

C Function: fgets()

A

fgets() reads a string from the keyboard

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

What is the general form of the C fgets() function

A

fgets(name, sizeof(name), stdin);

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

What is the first argument in an C fgets() function call

A

The name of the character array in which to save the contents of the string

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

What is the second argument in an C fgets function call

A

An integer that indicates the maximum number of characters to read, usually the size of the variable itself using the sizeof operator

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

What is the third argument in an C fgets function call

A

The file from which to read, usually stdin

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

C Function: isdigit()

A

isdigit() evaluates the number passed to it and if it is a decimal digit returns true and false otherwise

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

C Function: system()

A

system() allows your programs to call commands to the system

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

C Function: islower()

A

islower() evaluates the character passed to it and if it is a lowercase letter returns true and false otherwise

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

C Function: isupper()

A

isupper() evaluates the character passed to it and if it is an uppercase letter returns true and false otherwise

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

C Function: tolower()

A

tolower() converts the character passed to it to a lowercase letter

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

C Function: toupper()

A

toupper() converts the character passed to it to an uppercase letter

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

C Function: exp(x)

A

exp() returns the value of x to the power of x

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

C Function: pow(x, y)

A

pow() returns x raised to the power to y

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

C Function: sqrt()

A

sqrt() computes the square root of the number passed to it

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

C Function: log()

A

log() returns the natural logarithm (base e) of the number passed to it

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

C Function: log10()

A

log10() returns the logarithm (base 10) of the number passed to it

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

C Function: fabs()

A

fabs() returns the absolute value of the number passed to it

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

C Function: ciel(x)

A

ciel() rounds x to the smallest integer not less than x

27
Q

C Function: floor(x)

A

floor() rounds x to the largest integer not greater than x

28
Q

C Function: fmod(x, y)

A

fmod() returns the remainder of x/y as a floating-point number

29
Q

C Function: sin(x)

A

sin() returns the trigonometric sine of x in radians

30
Q

C Function: cos(x)

A

cos() returns the trigonometric cosine of x in radians

31
Q

C Function: tan(x)

A

tan() return the trigonometric tangent of x in radians

32
Q

C Function: isalnum()

A

isalnum() returns true if the character passed to it is an uppercase, lowercase letter, or a decimal digit and false otherwise

33
Q

C Function: ispunct()

A

ispunct() returns true if the character passed to it is a printing character that isspace() and isalnum() return false

34
Q

C Function: isspace()

A

isspace() returns true if the character passed to it is a whitespace character (space, ‘\n’, ‘t’, ‘v’, ‘r’, ‘f’)

35
Q

C Function: isblank()

A

isblank() returns true if the character passed to it is a standard blank character (space, ‘t’)

36
Q

C Function: iscntrl()

A

iscntrl() returns true if the character passed to it is a control character

37
Q

C Function: isgraph()

A

isgraph() returns true if the character passed to it is any printing character excluding space

38
Q

C Function: isprint()

A

isprint() returns true if the character passed to it is any printing character including space

39
Q

C Function: isxdigit()

A

isxdigit() returns true if the character passed to it is a hexadecimal digit

40
Q

C Function: isalpha()

A

isalpha() returns true if the character passed to it is an uppercase or lowercase letter

41
Q

C Function: fflush()

A

fflush() clears the contents of an input or an output buffer

42
Q

C Function: scanf()

A

scanf() obtains input typed in from the keyboard

43
Q

C Function: printf()

A

printf() is used to print formatted output

44
Q

C Function: rand()

A

rand() generates a whole number from 0 to a library-defined number

45
Q

C Function: srand()

A

srand() tells the rand() function to produce a true random number every time it is executed

46
Q

C Function: time()

A

time() returns the current time in seconds

47
Q

How do you obtain values in a certain range when using the C rand() function

A

from 0 to integer: rand() % integer and from 1 to integer: 1 + rand() % integer

48
Q

C Header: stdbool.h

A

stdbool.h makes it easier to work with boolean values

49
Q

C Header: assert.h

A

assert.h includes macros and information for adding diagnostics that aid program debugging

50
Q

C Header: ctype.h

A

ctype.h includes function prototypes for functions that test characters for certain properties, and function prototypes for functions that can be used to convert lowercase letters to uppercase letters and vice versa

51
Q

C Header: errno.h

A

errno.h includes macros that are useful for reporting error conditions

52
Q

C Header: float.h

A

float.h includes the floating-point size limits of the system

53
Q

C Header: limits.h

A

limits.h includes the integral size limits of the system

54
Q

C Header: locale.h

A

locale.h includes function prototypes and other information that enables a program to be modified for the current locale on which it’s running

55
Q

C Header: setjmp.h

A

setjmp.h includes function prototypes for functions that allow bypassing of the usual function call and return sequence

56
Q

C Header: signal.h

A

signal.h includes function prototypes and macros to handle various conditions that may arise during program execution

57
Q

C Header: stdarg.h

A

stdarg.h includes macros for dealing with a list of arguments to a function whose number and types are unknown

58
Q

C Header: stddef.h

A

stddef.h includes common type definitions used by C for performing calculations

59
Q

C Header: stdlib.h

A

stdlib.h includes function prototypes for conversions of numbers to text and text to numbers, memory allocation, random numbers, and other utility functions

60
Q

C Header: time.h

A

time.h includes function prototypes and types for manipulating the time and date

61
Q

C Haeder: string.h

A

string.h includes function prototypes for string-processing functions

62
Q

C Header: stdio.h

A

stdio.h contains functions for standard input/output

63
Q

C Header: math.h

A

math.h contains mathematical functions