CIS 1101 Prefinal - Pointers (PART 1)
CIS 1101 Prefinal - Master Your Pointers
Prepare to test your knowledge of pointers and data structures in C programming with our CIS 1101 Prefinal quiz! This quiz covers essential concepts such as pointers, fun
- Multiple choice and checkbox questions
- Covering core topics in pointers
- Fun and educational challenge
- This quiz consist of two tests. Be sure to READ the directions in each test before proceeding to the questions.
- Answer only according to what is being asked. Take note of the case of the letters and spacing. When told to answer in numbers, answer in decimal digit form, not word form - I.e. "1" not "one".
- NO CHEATING - Opening of other tabs and using of any computing devices or IDEs during the test are not allowed.
- Backtracking is DISABLED in this quiz - make sure you place a response and review before proceeding to the next item.
- This quiz consist of two tests. Be sure to READ the directions in each test before proceeding to the questions.
- Answer only according to what is being asked. Take note of the case of the letters and spacing. When told to answer in numbers, answer in decimal digit form, not word form - I.e. "1" not "one".
- NO CHEATING - Opening of other tabs and using of any computing devices or IDEs during the test are not allowed.
- Backtracking is DISABLED in this quiz - make sure you place a response and review before proceeding to the next item.
--- Test 1: Multiple Choice (25 points) ---
Choose the best answer/s that fits the question.
For those with multiple possible answers, a right minus wrong system is implemented.
--- Test 1: Multiple Choice (25 points) ---
Choose the best answer/s that fits the question.
For those with multiple possible answers, a right minus wrong system is implemented.
1. The attributes of a variable include: (Choose all that apply) (2 points)
Name
Data type
Value
Address
Size
Range
2. The symbol * is used for (Choose all that apply) (3 points)
Dereferencing a variable being set to point to.
Getting the address of the variable.
Determining how much memory the variable being pointed to stores.
Declaring a pointer variable.
3. Which of the following argument forms can be passed to a fun ction?
(Choose all that apply) (4 points)
Constant
Variable
Mathematical or logical expression with one or more operators
Another function with a return value
Another function without a return value
C keywords
4. Consider the fun ction with header:
void tripleInteger(int *n)
. Select all the correct statements below. (4 points)The fun ction does not have an implicit return.
The function does not have an explicit return.
The function may change the value of its actual arguments when called.
The value of the actual argument is copied internally to the function's memory space.
To call the fun ction above with parameter x, we write "
tripleInteger(int &x);
".The formal parameter is a pointer variable holding the value of the variable being passed.
5. Consider the fun ction header ction calls below. (4 points)
void func(int *A, int B)
. Select all of its corresponding valid funint x = 10;
func(&x, 10);
func(&10, 20);
int x = 10;
int *p = &x;
func(p, x);
int x=10;
func(&x,getNum());
/*assume getNum() is a fun ction that returns an integer */
int x = 10;
int *p = &x;
func(*p, x);
int x = 10;
int *p = &x;
func(p, *p);
6. The reason for using pointers in a C program is: (2 points)
I. Pointers allow different fun ctions to share and modify their local variables.
II. To pass large structures so that complete copy of the structure can be avoided.
III. Pointers enable complex “linked" data structures like linked lists and binary trees.
I and II
I and III
I and III
I, II, and III
7-12. Answer the following. (6 points)
- The proper declaration of a pointer a pointing to an integer.
- Gives the memory address of integer variable a.
- Gives the memory address of a variable pointed to by pointer a.
- Gives the value stored at the address pointed to by pointer a.
- The proper keyword to allocate memory in C.
- The proper keyword to deallocate memory in C.
Int &a; | Int *a; | A | *a | &a | Sizeof(a) | Free | Calloc | Malloc | |
---|---|---|---|---|---|---|---|---|---|
A. | |||||||||
B. | |||||||||
C. | |||||||||
D. | |||||||||
E. | |||||||||
F. |
--- Test 2: Code Fragment Tracing (15 points) ---
Study the code fragments being presented. Answer only according to what is being asked. Note that all answers are case- and space-sensitive.
If an output is being asked and there is no output, type "NONE"; and if the fragment has a syntax error which disables it to run, type "COMPILER ERROR".
--- Test 2: Code Fragment Tracing (15 points) ---
Study the code fragments being presented. Answer only according to what is being asked. Note that all answers are case- and space-sensitive.
If an output is being asked and there is no output, type "NONE"; and if the fragment has a syntax error which disables it to run, type "COMPILER ERROR".
13. Refer to the code above.
Question 1/3: What is the value of I after execution of function f() ? (2 points)
{"name":"CIS 1101 Prefinal - Pointers (PART 1)", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Prepare to test your knowledge of pointers and data structures in C programming with our CIS 1101 Prefinal quiz! This quiz covers essential concepts such as pointers, function arguments, and memory management.Multiple choice and checkbox questionsCovering core topics in pointersFun and educational challenge","img":"https:/images/course6.png"}