Wednesday, February 3, 2010

TRUE/FALSE C Programming Questions?

1. TRUE/FALSE


In C, all arrays passed to functions are passed by reference.





2.TRUE/FALSE


The string ';Bilbo Baggins';, may be stored in an array of 13 characters.





3.TRUE/FALSE


The declaration typedef int *intPtr; creates a variable called intPtr which can hold the address of (or point to) an integer.





4. TRUE/FALSE


If p is a pointer to structure variable called rec and number is a member of the structure, then to access the number member of rec using p, use the syntax p -%26gt; number





5. TRUE/FALSE


If p is a pointer to structure variable called rec and number is a member of the structure, then to access the number member of rec using p, use the syntax p.number





#6.TRUE/FALSE


Structures can only be passed to functions by reference.





7.TRUE/FALSE


The standard input, standard output, and standard error streams are opened automatically when your C program begins execution.





Can you explain your reason for your answer too please?





Thank you!TRUE/FALSE C Programming Questions?
1.) Kinda true...


Everything in C is passed by value. However, an array variable is a pointer, which contains a reference to the first elements of the array. So, your passing a reference by value.





2.) False


It's stated to be a string, so you do need to include the Null terminator.





3.) False. the typedef doesn't create a variable at all. It defines a type. If I then wrote:


intPtr myPtr;


Then I would have created a variable myPtr holding the address of an int.





4.) True


5.) False


http://www.lix.polytechnique.fr/~liberti鈥?/a>


Has a code example toward the bottom that might help explain these two.





6.) False. Structs can be passed by value.





7.) True. Not much explanation needed here.TRUE/FALSE C Programming Questions?
These are very simple homework questions - post whatever thoughts and answers you have come up with so far and maybe you will get some guidance. You need to try and answer them yourself first though.
8. TRUE/FALSE


You do your own homework.








FALSE

No comments:

Post a Comment