gdb, structs, and malloc quiz OS
strpbrk
Function __________ searches for the first occurrence in its first string argument of any character in its second string argument.
strchr
Function __________ searches for the first occurrence of a character in a string.
2012
Given that k is an integer array starting at location 2000, kPtr is a pointer to k, and each integer is stored in 4 bytes of memory, what location does kPtr + 3 point to?
delete 7
In gdb, which of the following can be used to delete a breakpoint on line 7.
l
In gdb, which of the following can be used to list lines of source code.
p
In gdb, which of the following can be used to print the value of a variable.
b 7
In gdb, which of the following can be used to set a breakpoint on line 7.
r
In gdb, which of the following can be used to start the program being debugged.
si
In gdb, which of the following can be used to take a single step to the next machine instruction, stepping into function calls.
ni
In gdb, which of the following can be used to take a single step to the next machine instruction, while stepping over function calls.
s
In gdb, which of the following can be used to take a single step to the next statment of code, including stepping into functions.
n
In gdb, which of the following can be used to take a single step to the next statment of code, while stepping over functions.
struct
Keyword __________ introduces the structure definition.
free(p->s); free(p);
Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program? #include #include int main() { struct ex { int i; float j; char *s }; struct ex *p; p = (struct ex *)malloc(sizeof(struct ex)); p->s = (char*)malloc(20); return 0; }
malloc() and calloc()
Specify the 2 library functions to dynamically allocate memory?
*Ptr
Three of the following expressions have the same value. Which of the following's value is different from the others?
free
What function should be used to free the memory allocated by malloc() ?
void* malloc(size_t);
Which of the following statement is correct prototype of the malloc() function in c ?
typedef
____ used to create a name that is an alias for a previously defined data type.
structures
__________ are collections of related variables under one name.