exam3-final-2011-fall_B-sol

exam3-final-2011-fall_B-sol - Department of Computer...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Department of Computer Science and Engineering, Texas A&M University CSCE- 206 (sections: 501 ~ 512) Structured Programming in C Fall 2011 - Exam 3 Test Form: B Name: ________________________ UIN: ________________________ Lab Section: ___________________ TA: ________________________ True/False Questions------------------------------------------------------------------------------------------- 1. A static variable defined inside a block is immortal, meaning it is lives as if it were a global variable. T 2. An unsigned int has no sign bit and the same number of bytes as int. T 3. The only integer variable that can be assigned to a pointer variable is the special value 0 (NULL). T 4. C has no subscript checking on arrays. T 5. If i is an integer and p is a pointer to int, the expressions: p = &i; and *p = i; are equivalent. F 6. The output of the following code is b F int main(void) { char c = „a‟ ; printf(“ % d\ n”, c+1); return 0; } 7. an extern variable MUST be defined outside of any blocks. T 8. Only two operations are allowed in pointer arithmetic: addition and subtraction. T 9. For call by reference: A dereferenced pointer is used in the function body to reference the argument in the calling function. T 10. The output of the following program is 6. T int main(void) { int p; int *q = &p; *q = 6; printf(“ %d \ n”,p); return 0; } 11. The following assignment is not legal: int* p = (int*)46532. F 12. An array is a collection of variables of various types. F
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
- 2 - 13. C compiler has subscript checking on arrays. F 14. Variable-length array can be declared as global variable (outside any function). F 15. The auto variable is limited to the block in which it is defined and its sub-blocks T 16. A pointer variable is a variable that is declared to hold a pointer to an object of its specified type. T 17. Inside a function, the following statements are different: F auto int a; int a; 18. According to the code segment below, q receives the address of m. F int q = 1, p = 2, *m = &p; q = *m; 19. means the address stored at p . T 20. Since an array name can be interpreted as a pointer the following code is correct. F int main(void) { int a[5]; a++; } 21. When an array is passed as an argument to a function, the array address is passed in for use in the function. T 22. When a multi-dimensional array is received as an argument, size of all the dimensions must be explicitly given in the function definition. F 23. Given the following declaration: int A[20]; int *p = &A[2]; p points to the second element of array A. F 24. An array reference of a[3.5] is valid in the C language. F 25. When an array is passed as an argument to a function, the array elements are duplicated for use in the function. F
Background image of page 2
- 3 - Multiple Choice Questions------------------------------------------------------------------------------------ 26. .What is the output? [Assume no errors] C int main(void) { int num1 = 65, num2 = 29; printf(“%d %d”, num1, num2); { int num1 = 5, num2 = 9;
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/19/2012 for the course GEOG 305 taught by Professor Prout during the Spring '08 term at Texas A&M.

Page1 / 13

exam3-final-2011-fall_B-sol - Department of Computer...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online