KEY PT1 PRF192

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

D. 14

11 ^ 5 What does the operation shown above produce? A. 1 B. 6 C. 8 D. 14 E. 15

B. ;

4. What punctuation ends most lines of C code? A. . B. ; C. : D. '

B. Procedural

C is which kind of language? A. Machine B. Procedural C. Assembly D. Object-oriented E. Strictly-typed

A. TRUE

CPU memory is volatile - the contents of the registers are lost as soon as power is turned off. A. TRUE B. FALSE

A. char ** (* p) [12][12] = array;

Consider array, defined above. Which one of the following definitions and initializations of p is valid? char ** array [12][12][12]; A. char ** (* p) [12][12] = array; B. char ***** p = array; C. char * (* p) [12][12][12] = array; D. const char ** p [12][12][12] = array; E. char (** p) [12][12] = array;

C. 21

Consider the code below int i, x=0; for(i=1; i<10; ++i) { if(i%2==1) x=x+i; else x--; } printf("%d",x); A. 23 B. 1 C. 21 D. 19 E. 20

A. 3

Consider the code below int i; int total = 0; int keepreading = 1; for(i=1;i<10&&keepreading==1; i++) if(!(i%3)) keepreading=0; else total+=i; printf("%d",total); A. 3 B. 1 C. 2 D. 6

B. 4

Consider the code below int[] = {1, 4, 8, 5, 1, 4}; int *ptr,y; ptr = x+4; y=ptr-x; What does y in the code above equal? A.1 B. 4 C. 5 D. -3 E. 0

A. True

Evaluate !(1 && !(0 || 1)). A. True B. False C. Unevaluatable

A. only 0

For which value(s) of the integer x will the following code become an infinite loop? int number=1; while(1) { printf("%d ",number); if (number == 3) break; number += x; } A. only 0 B. only 1 C. only 2 D. only 1 or 2

E. Allocated on the heap

Global variables that are declared static are ____________. Which one of the following correctly completes the sentence above? A. Deprecated by Standard C B. Internal to the current translation unit C. Visible to all translation units D. Read-only subsequent to initialization E. Allocated on the heap

A. typedef void (*funchandler_t) (int);

Which one of the following definitions of funchandler_t allows the above declaration to be rewritten as follows: funchandler_t func (int f, funchandler_t handler); void (*func(int f, void (*handler) (int))) (int); A. typedef void (*funchandler_t) (int); B. typedef funchandler_t void (*) (int); C. typedef void *funchandler_t (int); D. #define funchandler_t(x) void (*x) (int) E. #define funchandler_t void (*) (int)

E. memmove()

Which one of the following functions is the correct choice for moving blocks of binary data that are of arbitrary size and position in memory? A. memcpy() B. memset() C. strncpy() D. strcpy() E. memmove()

B. 1___

Which one of the following is NOT a valid C identifier? A. ___S B. 1___ C. ___1 D. ___ E. S___

E. fopen (filenm, "r");

Which one of the following is valid for opening a read-only ASCII file? A. fileOpen (filenm, "r"); B. fileOpen (filenm, "ra"); C. fileOpen (filenm, "read"); D. fopen (filenm, "read"); E. fopen (filenm, "r");

D. %-30.4f

Which one of the following printf() format specifiers indicates to print a double value in decimal notation, left aligned in a 30-character field, to four (4) digits of precision? A. %-30.4e B. %4.30e C. %-4.30f D. %-30.4f E. %#30.4f

A. The system stack

Which one of the following provides conceptual support for function calls? A. The system stack B. The data segment C. The processor's registers D. The text segment E. The heap

A. t = clock();

Which one of the following statements will properly initialize the variable t with the current time from the sample above? time_t t; A. t = clock(); B. time( &t ); C. t = ctime(); D. t = localtime(); E. None of the above

A. int *x; *x = 0x200;

Which one of the following will declare a pointer to an integer at address 0x200 in memory? A. int *x; *x = 0x200; B. int *x = &0x200; C. int *x = *0x200; D. int *x = 0x200; E. int *x( &0x200 );

B. struct foo var;

Which properly declares a variable of struct foo? A. struct foo; B. struct foo var; C. foo; D. int foo;

C. You might temporarily lose part of the data - such as truncating a float when typecasting to an int.

Why can typecasting be dangerous? A. Some conversions are not defined, such as char to int. B. You might permanently change the value of the variable. C. You might temporarily lose part of the data - such as truncating a float when typecasting to an int. D. There are no dangers.

E. free()

With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed? A. unalloc() B. dropmem() C. dealloc() D. release() E. free()

B. FILE *f;

f = fopen( filename, "r" ); Referring to the code above, what is the proper definition for the variable f? A. FILE f; B. FILE *f; C. int f; D. struct FILE f; E. char *f;

C. *(ptr + 3) = 10;

printf( "\n" ); Which one of the following statements could replace the ???? in the code above to cause the string 1-2-3-10-5- to be printed when the code is executed? int x[] = {1, 2, 3, 4, 5}; int u; int *ptr = x; ???? for( u = 0; u < 5; u++ ) { printf("%d-", x[u]); } A. *ptr + 3 = 10; B. *ptr[ 3 ] = 10; C. *(ptr + 3) = 10; D. (*ptr)[ 3 ] = 10; E. *(ptr[ 3 ]) = 10;

A. ptr = realloc( ptr, 5 * sizeof( struct employee));

struct employee *ptr = malloc( sizeof( struct employee ) ); Given the sample allocation for the pointer "ptr" found above, which one of the following statements is used to reallocate ptr to be an array of 5 elements? A. ptr = realloc( ptr, 5 * sizeof( struct employee)); B. realloc( ptr, 4 * sizeof( struct employee ) ); C. ptr += malloc( 4 * sizeof( struct employee ) ); D. ptr = realloc( ptr, 4 * sizeof( struct employee ) ); E. realloc( ptr, 5 * sizeof( struct employee ) );

E. 22,13,13,13

what will be the output when following code is executed int a=10,b; b=a++ + ++a; printf("%d,%d,%d,%d",b,a++,a,++a); A. 12,10,11,13 B. 22,10,11,13 C. 22,11,11,11 D. 12,11,11,11 E. 22,13,13,13

A. :

If you didn't do as well as you like, be sure to read through Cprogramming.com's tutorial on Switch..Case. Otherwise, congratulations! 1. Which follows the case statement? A. : B. ; C. - D. A newline

C. -2, -2.500000

Predict the output from: printf("%d, %f\n", 5/-2, 5/-2.); A. -3, -2.500000 B. -2, -2.000000 C. -2, -2.500000 D. a compiler or run time error

C. 2

Referring to the sample code above, what value will the variable counter have when completed? x = 3, counter = 0; while ((x-1)) { ++counter; x--; } A. 0 B. 1 C. 2 D. 3 E. 4

D. printf("\"My salary was increased by 15%%!\"\n");

Select the statement which will EXACTLY reproduce the line of text below: "My salary was increased by 15%!" A. printf("\"My salary was increased by 15/%\!\"\n"); B. printf("My salary was increased by 15%!\n"); C. printf("My salary was increased by 15'%'!\n"); D. printf("\"My salary was increased by 15%%!\"\n"); E. printf("\"My salary was increased by 15'%'!\"\n");

D. 32, 767

What is the maximum number that can be printed using printf("%d\n", x), assuming that x is initialized as shown above? short int x; /* assume x is 16 bits in size */ A. 127 B. 128 C. 255 D. 32, 767 E. 65, 536

C. main()

What is the only function all C programs must contain? A. start() B. system() C. main() D. program()

C. main()

What is the only function all C programs must contain? A. start() B. system() C. main() D. program()

A. 4

What is the output when th sample code below is executed? int i; i=1; i=i+2*i++; printf("%d"); A. 4 B. 1 C. 2 D. 3

D. 20 100

What is the output when the sample code below is executed? int calculate(int c) { c=c+15; if(c>=45) return(10); else return(10*10); } int main() { int a=20, b; b=calculate(a); printf("%d %d", a, b); return(0); } A. 45 100 B. 45 10 C. 20 10 D. 20 100 E. Compiler error

E. char c;

What is the proper declaration for the variable c in the code above? c = getchar(); A. char *c; B. unsigned int c; C. int c; D. unsigned char c; E. char c;

D. ZeroHello World

What is the result of the following code? int x=0; switch(x) { case 1: printf( "One" ); case 0: printf( "Zero" ); case 2: printf( "Hello World" ); } A. One B. Zero C. Hello World D. ZeroHello World

C. float

What is the return type of the function foo(with prototype) below: int foo(char x, loat v, double t); A. char B. int C. float D. double

B. int

What is the return type of the function with prototype: "int func(char x, float v, double t);" A. char B. int C. float D. double

E. 5

What is the value of myArray[1][2]; in the sample code above? int i,j; int ctr = 0; int myArray[2][3]; for (i=0; i<3; i++) for (j=0; j<2; j++) { myArray[j][i] = ctr; ++ctr; } A. 1 B. 2 C. 3 D. 4 E. 5

C. default

What keyword covers unhandled possibilities? A. all B. contingency C. default D. other

A. -4000

What number is equivalent to -4e3? A. -4000 B. -400 C. -40 D. .004 E. .-0004

C. 10

What number will z in the sample code above contain? int z,x=5,y=-10,a=4,b=2; z = x++ - --y * b / a; A. 5 B. 6 C. 10 D. 11 E. 12

A. FILE*

What object do you use to represent a file in C? A. FILE* B. fopen C. printf D. fprintf

A. { }

What punctuation is used to signal the beginning and end of code blocks? A. { } B. -> and <- C. BEGIN and END D. ( and )

A. fg

What string does ptr point to in the sample code above? char *ptr; char myString[] = "abcdefg"; ptr = myString; ptr += 5; A. fg B. efg C. defg D. cdefg E. None of the above

B. 26

What value will x contain in the sample code above? int x = 2 * 3 + 4 * 5; A. 22 B. 26 C. 46 D. 50 E. 70

B. 2

What value will x contain when the sample code above is executed? int x = 3; if( x == 2 ); x = 0; if( x == 3 ) x++; else x += 2; A. 1 B. 2 C. 3 D. 4 E. 5

E. 56789 0123456789

What will be printed when the sample code above is executed? char *buffer = "0123456789"; char *ptr = buffer; ptr += 5; printf( "%s\n", ptr ); printf( "%s\n", buffer ); A. 0123456789 56789 B. 5123456789 5123456789 C. 56789 56789 D. 0123456789 0123456789 E. 56789 0123456789

D. x=5

What will be printed when the sample code above is executed? int x = 0; for ( ; ; ) { if (x++ == 4) break; continue; } printf("x=%d\n", x A. x=0 B. x=1 C. x=4 D. x=5 E. x=6

D. x=4

What will be printed when the sample code above is executed? int x = 0; for (x=1; x<4; x++); printf("x=%d\n", x); A. x=0 B. x=1 C. x=3 D. x=4 E. x=5

C. 11 13 b

What will be the output of the following code fragment? The input is as follows: int x=11; printf("%d %o %x", x, x, x); A. 11 b 13 B. 11 15 b C. 11 13 b D. 11 b 15

E. It will loop indefinitely

What will happen when the program above is compiled and executed? #include <stdio.h> int i; void increment( int i ) { i++; } int main() { for( i = 0; i < 10; increment( i ) ) { } printf("i=%d\n", i); return 0; } A. It will not compile. B. It will print out: i=9. C. It will print out: i=10. D. It will print out: i=11. E. It will loop indefinitely

D. y = LO

What will print when the sample code above is executed? char* myFunc (char *ptr) { ptr += 3; return (ptr); } int main() { char *x, *y; x = "HELLO"; y = myFunc (x); printf ("y = %s \n", y); return 0; } A. y = HELLO B. y = ELLO C. y = LLO D. y = LO E. x = O

B. z=1.00

What will print when the sample code above is executed? int i = 4; int x = 6; double z; z = x / i; printf("z=%.2f\n", z); A. z=0.00 B. z=1.00 C. z=1.50 D. z=2.00 E. z=NULL

D. 0, 0, 1, 2, 3, 4,

What will the above sample code produce when executed? void myFunc (int x) { if (x > 0) myFunc(--x); printf("%d, ", x); } int main() { myFunc(5); return 0; } A. 1, 2, 3, 4, 5, 5, B. 4, 3, 2, 1, 0, 0, C. 5, 4, 3, 2, 1, 0, D. 0, 0, 1, 2, 3, 4, E. 0, 1, 2, 3, 4, 5,

A. -3 : 4 -4 : 3

What will the code above print when executed? ceil =>rounds up 3.2=4 floor =>rounds down 3.2=3 double x = -3.5, y = 3.5; printf( "%.0f : %.0f\n", ceil( x ), ceil( y ) ); printf( "%.0f : %.0f\n", floor( x ), floor( y ) ); A. -3 : 4 -4 : 3 B. -4 : 4 -3 : 3 C. -4 : 3 -4 : 3 D. -4 : 3 -3 : 4 E. -3 : 3 -4 : 4

E. 1 -- 1 1 -- 2

What will the code above print when it is executed? #include <stdio.h> void func() { int x = 0; static int y = 0; x++; y++; printf( "%d -- %d\n", x, y ); } int main() { func(); func(); return 0; } A. 1 -- 1 1 -- 1 B. 1 -- 1 2 -- 1 C. 1 -- 1 2 -- 2 D. 1 -- 0 1 -- 0 E. 1 -- 1 1 -- 2

A. i = 5;

What will the output of the sample code above be? int i = 4; switch (i) { default: ; case 3: i += 5; if ( i == 8) { i++; if (i == 9) break; i *= 2; } i -= 4; break; case 8: i += 5; break; } printf("i = %d\n", i); A. i = 5; B. i = 8; C. i = 9; D. i = 10; E. i = 18;

A. The variable's address

When applied to a variable, what does the unary "&" operator yield? A. The variable's address B. The variable's right value C. The variable's binary form D. The variable's value E. The variable's format

C. The variable's address

When applied to a variable, what does the unary "&" operator yield? A. The variable's value B. The variable's binary form C. The variable's address D. The variable's format E. The variable's right value

A. When x is less than one hundred

When does the code block following while(x<100) execute? A. When x is less than one hundred B. When x is greater than one hundred C. When x is equal to one hundred D. While it wishes

A. When x is less than one hundred

When does the code block following while(x<100) execute? A. When x is less than one hundred B. When x is greater than one hundred C. When x is equal to one hundred D. While it wishes

D. ==

Which of the following is the correct operator to compare two variables? A. := B. = C. equal D. ==

A. ptr = ptr + sizeof(myStruct);

Which of the following is the correct way to increment the variable "ptr"? void *ptr; myStruct myArray[10]; ptr = myArray; A. ptr = ptr + sizeof(myStruct); B. ++(int*)ptr; C. ptr = ptr + sizeof(myArray); D. increment(ptr); E. ptr = ptr + sizeof(ptr);

D. int *x;

Which of the following is the proper declaration of a pointer? A. int x; B. int &x; C. ptr x; D. int *x;

B. malloc

Which of the following is the proper keyword or function to allocate memory in C? A. new B. malloc C. create D. value

A. free

Which of the following is the proper keyword or function to deallocate memory? A. free B. delete C. clear D. remove

E. All of the above

Which of the following is true? A. 1 B. 66 C. .1 D. -1 E. All of the above

A fgets(x, 101, stdin);

Which of the following reads in a string named x with one hundred characters? A fgets(x, 101, stdin); B. fgets(x, 100, stdin); C. readline(x, 100, '\n'); D. read(x);

C. if ( expression )

Which of the following shows the correct syntax for an if statement? A. if expression B. if { expression C. if ( expression ) D. expression if

C. if( expression )

Which of the following shows the correct syntax for an if statement? A. if expression B. if{ expression C. if( expression ) D. expression if

A. 1+ rand( )%10

Which of the following statement would create a random number in the range of [1, 10] (inclusive) ? A. 1+ rand( )%10 B. rand( )%10 C. 1+ rand( )%11 D. rand( )%11

B. Understandability C. Modifiablity

Which of the following statements are true about maintainability in good software engineering? (select all correct answers) A. A program is small enough in size B. Understandability C. Modifiablity D. A program can run on any computer E. All of the above

B. The 0 prefix identifies the number as an octal number C. Each octal digit represents 3 bits of information E. Octal number system has 8 digits, 0-7

Which of the following statements are true about octal number representaion? A. Each octal digit represents 2 bits of information B. The 0 prefix identifies the number as an octal number C. Each octal digit represents 3 bits of information D. The oc prefix identifies the number as an octal number E. Octal number system has 8 digits, 0-7

C. The execution unit (EU) executes the instructions one at a time

Which of the following statements is true? A. The execution unit (EU) executes the instructions two at a time B. The execution unit (EU) executes the instructions three at a time C. The execution unit (EU) executes the instructions one at a time D. The execution unit (EU) executes many instructions at a time

A. =

Which one is a right associative C operator? A. = B. , C. [] D. ^ E. ->

A. f == EOF

Which one of the following can replace the ???? in the code above to determine if the end of a file has been reached? A. f == EOF B. feof( f ) C. eof( f ) D. f == NULL E. !f

A. 10

What is the final value of x when the code int x; for(x=0; x<10; x++) {} A. 10 B. 9 C. 0 D. 1

A. 10

What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run? A. 10 B. 9 C. 0 D. 1

A. conio

What is the header file containing getch() function? A. conio B. stdlib C. stdio.h D. all of the above

B. 28

What is the index number of the last element of an array with 29 elements? A. 29 B. 28 C. 0 D. Programmer-defined

B. real

Which of the following is not a correct variable type? A. float B. real C. int D. double

B. &&

Which of the following is the boolean operator for logical-and? A. & B. && C. | D. |&

D. ==

Which of the following is the correct operator to compare two variables? A. := B. = C. equal D. ==

C. float

According to Standard C, what is the type of an unsuffixed floating-point literal, such as 123.45? A. long double B. Unspecified C. float D. double E. signed float

D. 2, 2, 4

According to the Standard C specification, what are the respective minimum sizes (in bytes) of the following three data types: short; int; and long? A. 1, 2, 2 B. 1, 2, 4 C. 1, 2, 8 D. 2, 2, 4 E. 2, 4, 8

C. 6

After the sample code below has been executed, what value will the variable x contain? int x = 5; int y = 2; char op = '*'; switch (op) { default : x += 1; case '+' : x += y; case '-' : x -= y; } A. 4 B. 5 C. 6 D. 7 E. 8

A. Call fopen on the file

Before you can read or write to a file in C, what do you need to do? A. Call fopen on the file B. Create the file C. Call fclose on the file D. Use fprintf

C.%e always displays an argument of type double in engineering notation; %f always displays an argument of type double in decimal notation.

How do printf()'s format specifiers %e and %f differ in their treatment of floating-point numbers? A. %e displays an argument of type double with trailing zeros; %f never displays trailing zeros. B.%e displays a double in engineering notation if the number is very small or very large. Otherwise, it behaves like %f and displays the number in decimal notation. C.%e always displays an argument of type double in engineering notation; %f always displays an argument of type double in decimal notation. D.%e expects a corresponding argument of type double; %f expects a corresponding argument of type float. E.%e and %f both expect a corresponding argument of type double and format it identically. %e is left over from K&R C; Standard C prefers %f for new code.

A. Use the "b" flag to fopen

How do you open a file for binary IO? A. Use the "b" flag to fopen B. Files are opened for binary IO by default C. Use fread and fwrite D. You need to use a special file type, BINARYFILE*

A. Open file and use fprintf.

How do you write a string of text into a file? A. Open file and use fprintf. B. Open a file and use printf, the output will go to the file instead of the screen. C. Open a file, and use fputc repeatedly. D. Use fread to read data into the file.

C. Variables may be defined many times, but may be declared only once.

How does variable definition differ from variable declaration? A. Definition allocates storage for a variable, but declaration only informs the compiler as to the variable's type. B. Declaration allocates storage for a variable, but definition only informs the compiler as to the variable's type. C. Variables may be defined many times, but may be declared only once. D. Variable definition must precede variable declaration. E. There is no difference in C between variable declaration and variable definition.

A. The global variable is referenced via the extern specifier.

How is a variable accessed from another file? A. The global variable is referenced via the extern specifier. B. The global variable is referenced via the auto specifier. C. The global variable is referenced via the global specifier. D. The global variable is referenced via the pointer specifier. E. The global variable is referenced via the ext specifier.

C. enum coin {penny=1,nickel=5,dime=10,quarter=25};

How is enum used to define the values of the American coins listed above? How is enum used to define the values of the American coins listed above? A. enum coin {(penny,1), (nickel,5), (dime,10), (quarter,25)}; B. enum coin ({penny,1}, {nickel,5}, {dime,10}, {quarter,25}); C. enum coin {penny=1,nickel=5,dime=10,quarter=25}; D. enum coin (penny=1,nickel=5,dime=10,quarter=25); E. enum coin {penny, nickel, dime, quarter} (1, 5, 10, 25);

C. thrice

How long does the following code run? for(int x=0; x<=2; x++) A. none B. twice C. thrice D. forever

D. 20 bytes

How many bytes are allocated by the definition above? char txt [20] = "Hello world!\0"; A. 11 bytes B. 12 bytes C. 13 bytes D. 20 bytes E. 21 bytes

B. 5

How many elements does the array dwarves (declared above) contain? Assume the C compiler employed strictly complies with the requirements of Standard C. char * dwarves [] = { "Sleepy", "Dopey" "Doc", "Happy", "Grumpy" "Sneezy", "Bashful", }; A. 4 B. 5 C. 3 D. 7 E. 8

C. 1

How many times is a do while loop guaranteed to loop? A. 0 B. Infinitely C. 1 D. Variable

B. break;

What is required to avoid falling through from one case to the next? A. end; B. break; C. Stop; D. A semicolon.

C. 0

What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value

C. 0

What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value.

D. 9

What is printed when the sample code above is executed? int y[4] = {6, 7, 8, 9}; int *ptr = y + 2; printf("%d\n", ptr[ 1 ] ); /*ptr+1 == ptr[1]*/ A. 6 B. 7 C. 8 D. 9 E. The code will not compile.

C. '\0'

What character ends all strings? A. '.' B. ' ' C. '\0' D. '\n'

B. It indicates that a variable's memory will automatically be preserved.

What does the "auto" specifier do? A. It automatically initializes a variable to 0;. B. It indicates that a variable's memory will automatically be preserved. C. It automatically increments the variable when used. D. It automatically initializes a variable to NULL. E. It indicates that a variable's memory space is allocated upon entry into the block.

A. 1 2

What does the following code fragment print? int x=0; while(++x<3) printf("%d",x); A. 1 2 B. 2 3 C. 1 2 3 D. 0 1 2

A. a

What flag do you need to pass to fopen to append to an existing file instead of recreating the file? A. a B. r C. w D. W+

d). A declaration occurs once, but a definition may occur many times.

What is a difference between a declaration and a definition of a variable? a). Both can occur multiple times, but a declaration must occur first. b). There is no difference between them c). A definition occurs once, but a declaration may occur many times. d). A declaration occurs once, but a definition may occur many times.

D. All are possible

Which conversion is not possible? A. int to float B. float to int C. char to float D. All are possible

D. All are possible

Which conversion is not possible? A. int to float B. float to int C. char to float D. All are possible

D. None

Which header file do you need to include to use typecasting? A. stdin.h B. ctype.h C. math.h D. None

A. To allow division of two integers to return a decimal value.

Which is a good use for typecasting? A. To allow division of two integers to return a decimal value. B. To allow your program to use nothing but integers. C. To change the return type of a function. D. To swap variables rapidly.

A. To allow division of two integers to return a decimal value. đúng

Which is a good use for typecasting? A. To allow division of two integers to return a decimal value. đúng B. To allow your program to use nothing but integers. C. To change the return type of a function. D. To swap variables rapidly

C. (char)a;

Which is a valid typecast? A. a(char); B. char:a; C. (char)a; D. to(char, a);

D. repeat until

Which is not a loop structure in C? A. for B. do while C. while D. repeat until

D. repeat until

Which is not a loop structure? A. for B. do while C. while D. repeat until

B. double funct(char x)

Which is not a proper prototype? A. int funct(char x, char y); B. double funct(char x) C. void funct(); D. char x();

B. double funct(char x)

Which is not a proper prototype? A. int funct(char x, char y); B. double funct(char x) C. void funct(); D. charx();

B. if, else, for, while do, switch, continue, break

Which line has all reserved words? Select one: A. sizeof, const, typedef, static, voided, enum, struct, union B. if, else, for, while do, switch, continue, break C. char, int, float, doubleld, short, longm unsigned, signed D. defaulted, goto, return, extern, private, public, protected

A. for (c = 0; c <= 5; c++)

Which loop that counts from 0 to 5 A. for (c = 0; c <= 5; c++) B. for (int c = 0; c <= 6; c++) C. for (c = 0; c < 5; c++) D. for (c = 0; c <= 4; c++)

b->var;

Which of the following accesses a variable in a pointer to a structure, *b? A. b->var; B. b.var; C. b-var; D. b>var;

B. b.var;

Which of the following accesses a variable in structure b? A. b->var; B. b.var; C. b-var; D. b>var;

C. strcat();

Which of the following adds one string to the end of another? A. append(); B. stringadd(); C. strcat(); D. stradd();

A. foo[6];

Which of the following correctly accesses the seventh element stored in foo, an array with 100 elements? A. foo[6]; B. foo[7]; C. foo(7); D. foo;

A. int anarray[10];

Which of the following correctly declares an array? A. int anarray[10]; B. int anarray; C. anarray{10}; D. array anarray[10];

D. strcmp();

Which of the following functions compares two strings? A. compare(); B. stringcompare(); C. cmp(); D. strcmp();

A. a;

Which of the following gives the memory address of a variable pointed to by pointer a? A. a; B. *a; C. &a; D. address(a);

C. &a;

Which of the following gives the memory address of integer variable a? A. *a; B. a; C. &a; D. address(a);

B. foo;

Which of the following gives the memory address of the first element in array foo, an array with 100 elements? A. foo[0]; B. foo; C. &foo; D. foo[1];

C. *a;

Which of the following gives the value stored at the address pointed to by pointer a? A. a; B. val(a); C. *a; D. &a;

B. int funct(int x) {return x=x+1;}

Which of the following is a complete function? A. int funct(); B. int funct(int x) {return x=x+1;} C. void funct(int) {printf( "Hello" ); D. void funct(x) {printf( "Hello" ); }

C. /* Comment */

Which of the following is a correct comment? A. */ Comments */ B. ** Comment ** C. /* Comment */ D. { Comment }

D. /* Comment */

Which of the following is a correct comment? A. */ Comments */ B. ** Comment ** C. { Comment } D. /* Comment */

D. struct a_struct {int a;};

Which of the following is a properly defined struct? A. struct {int a;} B. struct a_struct {int a;} C. struct a_struct int a; D. struct a_struct {int a;};

B. "Static String"

Which of the following is a string literal? A. Static String B. "Static String" C. 'Static String' D. char string[100];

B. int anarray[20][20];

Which of the following is a two-dimensional array? A. array anarray[20][20]; B. int anarray[20][20]; C. int array[20, 20]; D. char array[20];

C. funct();

Which of the following is a valid function call (assuming the function exists)? A. funct; B. funct x, y; C. funct(); D. int funct();

B. real

Which of the following is not a correct variable type? A. float B. real C. int D. double

E. 11

int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; What value does testarray[2][1][0] in the sample code above contain? A. 3 B. 5 C. 7 D. 9 E. 11

D. MAX_NUM is a preprocessor macro.

referring to the sample below what is max_num? # define max_num 15 A. MAX_NUM is an integer variable. B. MAX_NUM is a linker constant. C. MAX_NUM is a precompiler constant. D. MAX_NUM is a preprocessor macro. E. MAX_NUM is an integer constant.


संबंधित स्टडी सेट्स

CHE 231 FInal: Reduction of Ketones using Metal Hydride: Synthesis of cyclohexanol

View Set

Comparative Politics Exam One (Quiz Questions)

View Set

AP Psych: Unit 9 Developmental Psychology and LearningCurve Examples

View Set

Chapter 13: Brain and Cranial Nerves

View Set

Spanish Interrogatives-Question words

View Set

chapter 2: Computing Wages & Salaries.

View Set

Professional Practice final - cumulative chapters

View Set

Chapter 8 - Nucleotides and Nucleic Acids

View Set