1/17
Practice flashcards covering C Boolean types, Vim configuration settings for CSSE2310, and implementation details for a Tic Tac Toe program including library headers and array logic.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
In the C programming language, how are numerical values interpreted as Boolean values?
A value of 0 is interpreted as false, while any non-zero value is interpreted as true.
What header file must be included to use the specific bool type in C?
stdbool.h
Why is stdbool.h required instead of the bool type being a standard, built-in part of the original C language?
The bool type was added to the C language later, and developers had already defined their own Boolean types in the interim.
What is the effect of the pre-increment operator used in the expression ++i?
It increments the variable i by 1 (i=i+1) and then returns the new value for use in the expression.
What does the expression if(x=7) do in C if the programmer intended to check if x equals 7?
It performs an assignment operation, setting x to 7, and since the result (7) is non-zero, the condition always evaluates to true.
What is the path for the standard Vim configuration file recommended in the course?
local/courses/csse2310/resources/vimrc
According to the lecture's style guide, what is the maximum number of characters permitted per line?
80 characters (with a ruler often set at column 81).
In the provided Vim configuration, what keyboard shortcut is mapped to reformat code to match the style guide's indentation and spacing?
Control+k
When passing an array to a function in C, what is actually passed?
A pointer to the first element (firstmember) of the array, rather than a copy of the entire array.
If a Tic Tac Toe board is represented by cell numbers 0 through 8, what formula converts a cell number to a row number in a 3×3 grid?
\text{row} = \text{cell_number} / 3
What is the modulo formula for determining the column number from a cell number in a 3×3 grid?
\text{column} = \text{cell_number} \pmod 3
Which function is used in the lecture to read a string from standard input while specifying a buffer size?
fgets()
What header file is required to use the atoi() function for converting strings to integers?
stdlib.h
What is a specific behavior of the atoi() function when it encounters a string that is not a numeric value?
It returns 0 without performing error checking on the string.
Which header file must be included to use the character check function isdigit()?
ctype.h
How does the fgets() function handle new line characters?
If a new line character is read, it is stored into the buffer.
What header is necessary to use the strlen() function for calculating the length of a string?
string.h
How does the ternary operator player==′x′?′o′:′x′ function?
It evaluates if the current player is ′x′; if true, it returns ′o′; otherwise, it returns ′x′.