Pointers and Dynamic Memory Allocation, computer science homework help

User Generated


Computer Science


Question 1

  Dynamic Memory Allocation that we studied this week happens at

a)  Run Time

b)  Compile Time

c)  Play Time

d)  None of the Above

Question 2

  Which is proper way to use a pointer to a structure to reference the wage member?

a)  (*emp_ptr).wage

b)  emp_ptr -> wage

c)  Both the first two answers will do the same thing

d)  None of the Above

Question 3

  A structure can have a member who is declared to be a pointer to some type in C

a)  True

b)  False

Question 4

  Each item in a linked list is referred to as a ...

a)  node

b)  link

c)  value

d)  handle

Question 5

  Which is a false statement about "malloc"

a)  Is a function that is part of the C Library

b)  Returned area in the heap is initialized to 0

c)  returns 0 if unable to allocate memory in the heap

d)  returns a pointer to the start of the area in the heap

Question 6

  cfree is used to return back memory in the heap allocated with the malloc statement

a)  True

b)  False

Question 7

  Given that a is an array name, and i is an index to that array:  Which is the basic rule that suggests the relationship between pointer and arrays?

a)  a [ i ] = ( * ( a + i ) )

b)  i  = ( * ( a + i ) )

c)  a [ i ] = * i

d)  a [ i ] =  i

Question 8

  Given:  char a[ ] = "0123456789"; and int i = 5; ... it is possible to reference i [ a ] ?

a)  True

b)  False

Question 9

  Which of the following is the proper keyword or function to deallocate memory?

a)  free

b)  delete

c)  clear

d)  remove

Question 10

  Which of the following is the proper keyword or function to allocate memory in C?

a)  new

b)  malloc

c)  create

d)  value

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Q1: a) RuntimeQ2:a)  (*emp_ptr).wageQ3: a...

I use Studypool every time I need help studying, and it never disappoints.


Related Tags