CSCI 1730 MIDTERM REVIEW QUESTIONS
how do you know if a line in your source code is a preprocessor directive?- Answer
- be- gins with a "#"
ex. #include
1. what does "compile" do?- Answer - turn the source code to an object code
2. what does "link" do?- Answer - turn the object code to an executable
3. what are the format specifiers?- Answer - begin with % and are used as placeholders to define the
format and type of data to be printed
4. format specifier to print base 10 signed int- Answer - %d
5. format specifier to print base 10 unsigned int- Answer - %u
6. format specifier to print floating point values- Answer - %f
7. format specifier to print pointers- Answer - %p
8. format specifier to print hexadecimals- Answer - %x
9. format specifier to print characters- Answer - %c
10. format specifier to print strings- Answer - %s
11. valid names for a makefile-
Answer - makefile Makefile
12. default target- Answer - first target defined in the makefile
13. how can target dependencies be specified?- Answer - after the target name and the colon(-
Answer -), specify a list of space-seperated dependencies
14. how are strings represented in C- Answer - data type is just an array of characters
15. diff b/w array and array of char- Answer - array of char to quaify as a string in C, the special null
charcter (\0) must be the last charcter
1/5
, 16. diff b/w array and array of char- Answer - null character is used to indicate the end of the string
17. declare a pointer- Answer -
18. how to obtain the memory of address of variable?- Answer - -use the "address of"
operator &
-ptr = &x;
19. how do you retrieve the data value that a pointer points to? how do
you update the data value using that pointer?- Answer - - use dereference
operator*
- int y = *ptr;
- *ptr = 10
20. 6 phases of a C program- Answer - 1. editing in the editor
2. preprocess - processes the code
2/5
how do you know if a line in your source code is a preprocessor directive?- Answer
- be- gins with a "#"
ex. #include
1. what does "compile" do?- Answer - turn the source code to an object code
2. what does "link" do?- Answer - turn the object code to an executable
3. what are the format specifiers?- Answer - begin with % and are used as placeholders to define the
format and type of data to be printed
4. format specifier to print base 10 signed int- Answer - %d
5. format specifier to print base 10 unsigned int- Answer - %u
6. format specifier to print floating point values- Answer - %f
7. format specifier to print pointers- Answer - %p
8. format specifier to print hexadecimals- Answer - %x
9. format specifier to print characters- Answer - %c
10. format specifier to print strings- Answer - %s
11. valid names for a makefile-
Answer - makefile Makefile
12. default target- Answer - first target defined in the makefile
13. how can target dependencies be specified?- Answer - after the target name and the colon(-
Answer -), specify a list of space-seperated dependencies
14. how are strings represented in C- Answer - data type is just an array of characters
15. diff b/w array and array of char- Answer - array of char to quaify as a string in C, the special null
charcter (\0) must be the last charcter
1/5
, 16. diff b/w array and array of char- Answer - null character is used to indicate the end of the string
17. declare a pointer- Answer -
18. how to obtain the memory of address of variable?- Answer - -use the "address of"
operator &
-ptr = &x;
19. how do you retrieve the data value that a pointer points to? how do
you update the data value using that pointer?- Answer - - use dereference
operator*
- int y = *ptr;
- *ptr = 10
20. 6 phases of a C program- Answer - 1. editing in the editor
2. preprocess - processes the code
2/5