Major Field Test Sample Questions (need further clarification) I have several questions that do no make sense for me. 

First Question:
A stack can be implemented with an array A[0..N-1] and a variable pos. The push and pop operations are defined by the following code.

push (x)
  A[pos] &lt;- x
  pos &lt;- pos – 1 
end push

pop ( )
  pos &lt;- pos + 1
  return A[pos] 
end pop


Which of the the following will initialize an empty stack with capacity N for this implementation?

a)pos &lt;- -1 

b)pos &lt;- 0

c)pos &lt;- 1

d)pos &lt;- N - 1 

e)pos &lt;- N

I have zero idea for this question and I dont understand what is being asked

Second Question: Consider the following recursive function

int Fun ( int n ) 
if ( n == 4 )
  return 2 
 else
  return 2 * Fun ( n + 1 ) 
 end if
end Fun


What is the value returned by the function call Fun(2)? 

a)2

b)4

c)8

d)16

e)24

The answer is C but I got 6 cox this is how I did it, because n is 2 and it not 4 so it return 2 * (2+1) which is equal to 6

Third Question: Following is a definition of a widget and a declaration of an array A that contains 10 widgets. The size of a byte, short, int, and long are 1,2,4 and 8 bytes, respectively. Alignment is restricted so that an n-byte field must be located at an address divisible by n. Th fields in a struct are not rearranged padding is used to ensure alignment. All widgets in A must have the same size

struct widget 
  short s
  byte b 
  long l 
  int i
end widget 

widget A[10]


Assuming that A is located at a memory address divisible by 8, what is the total size of A, in bytes?

a)150

b)160

c)200

d)240

e)320

The answer is D but I dont understand why is it D and not C.
I will try my best to explain the first question. 

They are basically asking what value pos need to be in order for the stack to be empty. Since we are using an array as a stack, we have a choice between 0 or N-1. Looking at the code, Pop increment pos and push decrement pos. We want to follow pop because it pops the first element and so on to the last element. If we pop all elements in the array it will equal N-1 values. The answer should be D.