CS 7643 QUIZ 1 PREP SET 2026 TESTED
QUESTIONS WITH RATIONALE
◉ When the standard input buffer is empty and your program calls
fgetc, what is the resultant behavior of your program: Answer: Wait
for input
◉ Convert 0x9 to binary: Answer: 1001
◉ List two situations that cause the standard output buffer to be
displayed to the screen when running a C program? Answer:
program ends normally and request input from user
◉ What character is the last one entered in every user response in C,
C++ and Java when reading from standard input: Answer: \n
◉ Convert 0x5 to binary: Answer: 0101
◉ Convert to hexadecimal: 0000 1111 1110 1110 1101 1101 1010
1101 Answer: 0x0FEEDDAD
◉ Write the decimal value that represents all 1s for 64 bits as a
signed value Answer: -1
, ◉ Should you store the newline character as part of the string
formed by getaline? Answer: No
◉ Should you store the NULL character as part of the string formed
by getaline? Answer: Yes
◉ Assuming the following line of code in C executed, list one
situation where the string is not displayed to the user:
fprintf (stdout, "Hello World"); Answer: infinite loop
◉ stderr is used to display what two kinds of messages: Answer:
error and debug messages
◉ What is the length of the string "ABC"? Answer: 3
◉ What two commands must you enter at the UNIX command line
from the ~/../public/hw2 directory to begin working on hw2?
Answer: make directories
make install
◉ Convert 0xa to binary: Answer: 1010
QUESTIONS WITH RATIONALE
◉ When the standard input buffer is empty and your program calls
fgetc, what is the resultant behavior of your program: Answer: Wait
for input
◉ Convert 0x9 to binary: Answer: 1001
◉ List two situations that cause the standard output buffer to be
displayed to the screen when running a C program? Answer:
program ends normally and request input from user
◉ What character is the last one entered in every user response in C,
C++ and Java when reading from standard input: Answer: \n
◉ Convert 0x5 to binary: Answer: 0101
◉ Convert to hexadecimal: 0000 1111 1110 1110 1101 1101 1010
1101 Answer: 0x0FEEDDAD
◉ Write the decimal value that represents all 1s for 64 bits as a
signed value Answer: -1
, ◉ Should you store the newline character as part of the string
formed by getaline? Answer: No
◉ Should you store the NULL character as part of the string formed
by getaline? Answer: Yes
◉ Assuming the following line of code in C executed, list one
situation where the string is not displayed to the user:
fprintf (stdout, "Hello World"); Answer: infinite loop
◉ stderr is used to display what two kinds of messages: Answer:
error and debug messages
◉ What is the length of the string "ABC"? Answer: 3
◉ What two commands must you enter at the UNIX command line
from the ~/../public/hw2 directory to begin working on hw2?
Answer: make directories
make install
◉ Convert 0xa to binary: Answer: 1010