h*****g 发帖数: 944 | 1 Q1)
what are the variable types in the statement below?
int * x, y;
a) both x and y are of type int *
b) x is of type int* and y is of type int
c) x is of type int and y is of type int*
d) both x and y are of type int
我选的是b
Q2)
which of the following is a correct declaration for a pointer to a function
that returns a double and takes no arguments?
a) double (*ptr_function)(void);
b) double (ptr_function)(void);
c) double ptr_function(void);
d) double *ptr_function(void);
Q3)
Which of the following statements is false?
a) It is not legal to take the address of a register variable.
b) a static variable is never visible in more than one file
c) declaring an extern variable allows access to another files variable
d) void pointers need an explicit cast when copied to non-void pointers
Q4
Which of the following pairs of statements correctly uses a typedef to
create the new name COUNT of type int and declare instances of type
COUNT called people and dogs?
a) typedef int COUNT; COUNT people, dogs
我选的这个应该没错吧?
Q5
Which of the following correctly declares an instance of the enumeration
plant_status named plant and assigns it the status full_operation?
A) enum plant_status plant=plant_status.full_operation;
b) enum plant_status plant=full_operation;
c) plant_status plant=plant_status.full_operation
d) plant_status plant=full_operation;
e) enum plant_status{full_operation, limited_operation};
Q6
which of the following is true of when memory is dynamically allocated used
malloc() or calloc()?
a) that memory must be deallocated with the free() function
b) that memory must be deallocated with the demalloc() function
c) that memory must be deallocated with the delete operator
d) that memory will be deallocated by the built in garbage collection |
e********s 发帖数: 248 | |
r****o 发帖数: 1950 | 3 why 3rd is b?
【在 e********s 的大作中提到】 : My answers: b a b a b a
|
e********s 发帖数: 248 | 4 For #3, I am not too sure about a.
But for b, how about
== a.1
static int v;
do something with v;
== a.c
#include "a.1"
do something else with v;
【在 r****o 的大作中提到】 : why 3rd is b?
|
r****o 发帖数: 1950 | 5 This sounds good.
【在 e********s 的大作中提到】 : For #3, I am not too sure about a. : But for b, how about : == a.1 : static int v; : do something with v; : == a.c : #include "a.1" : do something else with v;
|
m********l 发帖数: 89 | 6 第三题a应该是错的 因为在embedded dev.里经常要这么做 前提是要把一个register映
射到某个内存位置上,例如:
volatile Uint32 *base = (volatile Uint32 *) 0x12345678;
function
【在 h*****g 的大作中提到】 : Q1) : what are the variable types in the statement below? : int * x, y; : a) both x and y are of type int * : b) x is of type int* and y is of type int : c) x is of type int and y is of type int* : d) both x and y are of type int : 我选的是b : Q2) : which of the following is a correct declaration for a pointer to a function
|