Which file open mode will not create a new file if the given one does not exist?
what is r (read)
What operation inverts the bits
~ (complement)
What is the purpose of an ADT?
To hide the implementation from the user
this C keyword defines a new name for a type to be defined
What is typedef
The goal of translation is to convert source code into ___
What is an executable load module / machine code
What does the function fgetc() do?
What is Gets one character from a file.
1011 ^ 1100 =
what is 0111
The _____ for an ADT serves as the interface for the client
What is header file
What will changing sh[1] also change for
union Thing{
char ch[3]
int x;
float y;
short sh[2];
char c;
}
What is ch[2], ch[1], x, y, and c
The compiler, consists of 3 analyses: what are they?
what is lexical, syntax, semantic
Which function writes to a file in binary?
what is fwrite()
1001 << 2
what is 0100
C is a ___-typed language that does ___ typing
what is weakly and static
What is the size of the union below?
union u{
char c[8];
int i[4];
void * v[3];
double d;
unsigned short s[10];
};
What is 24 (8 * 3)
The linker links your code to other c programs as well as external ___
what is libraries
What is fread(ptr, sizeof(int), 2, file)
char a = 0xf2;
printf("0x%02x\n", (a >> 4) & 0xff);
What is 0xff
Scalar types...what are they?
what is decimal numbers + discrete types
(floats, chars, longs, etc...)
create a struct with bitfields for a specialized unsigned char such that
- 2 bits specify input
- 1 bit specifies a flag
- 5 bits are used for data
struct bitField{
unsigned char input : 2;
unsigned char flag : 1;
unsigned char data : 5;
};
Wild card: first team to draw the proper syntax tree for the following expression wins:
10 - 4 - 3
With the grammar rules
Expression --> term | expression add_op term
term --> factor
factor --> identifier | number | -factor | (expression)
add_op --> + | -
What is, Im not typing up the answer
Finish the line below so that it opens the .c file of the current program to read it in binary.
FILE* file = ____
What is FILE* file = fopen(__FILE__, "rb");
unsigned char a = 0b10001000;
char b = 0b11110000;
printf("%i\n", ~a & b || 0b00110011);
what is 1
Given the definition
typedef struct coolADT_s* CoolADT;
make the following function:
CoolADT cool_create();
What is:
CoolADT cool_create(){
CoolADT newCool = (CoolADT) malloc (sizeof(struct coolADT_s));
assert(newCool != 0);
return newCool;
}
What is the size of the following struct:
This is the size of the following struct:
struct country{
char name[50];
long population;
short data;
float more_data;
};
What is 72 bytes
Given the following defines:
What is the result of the following code?
#define ADD4(x) 4+x
#define SQU(y) y*y
int main( void ){
int a = 3;
printf("%d\n", SQU(ADD4(a)));
return 0;
}
what is 19