exam3-final-2011-fall_A-sol

exam3-final-2011-fall_A-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: A Name: ________________________ UIN: ________________________ Lab Section: ___________________ TA: ________________________ True/False Questions------------------------------------------------------------------------------------------- 1. The only integer variable that can be assigned to a pointer variable is the special value 0 (NULL). T 2. C has no subscript checking on arrays. T 3. The output of the following code is b F int main(void) { char c = „a‟; printf(“ %d\n”,c+1); return 0; } 4. an extern variable MUST be defined outside of any blocks. T 5. The auto variable is limited to the block in which it is defined and its sub-blocks T 6. A static variable defined inside a block is immortal, meaning it is lives as if it were a global variable. T 7. An unsigned int has no sign bit and the same number of bytes as int. T 8. A pointer variable is a variable that is declared to hold a pointer to an object of its specified type. T 9. Inside a function, the following statements are different: F auto int a; int a; 10. According to the code segment below, q receives the address of m. F int q = 1, p = 2, *m = &p; q = *m; 11. means the address stored at p . T 12. Only two operations are allowed in pointer arithmetic: addition and subtraction. T 13. For call by reference: A dereferenced pointer is used in the function body to reference the argument in the calling function. T
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 - 14. 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; } 15. If i is an integer and p is a pointer to int, the expressions: p = &i; and *p = i; are equivalent. F 16. The following assignment is not legal: int* p = (int*)46532. F 17. An array is a collection of variables of various types. F 18. C compiler has subscript checking on arrays. F 19. Variable-length array can be declared as global variable (outside any function). F 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. An array reference of a[3.5] is valid in the C language. F 24. When an array is passed as an argument to a function, the array elements are duplicated for use in the function. F 25. Given the following declaration: int A[20]; int *p = &A[2]; p points to the second element of array A. F
Background image of page 2
- 3 - Multiple Choice Questions------------------------------------------------------------------------------------ 26. What format is used to display a string in a printf()? A A) %s B) %f C) %c D) %t E) %m 27. Which of the follow is the correct form for a string that has the value a? C
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_A-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