Question #1 Question #6 What number of digits that can be accurately stored Evaluate the following as true or false: ! in a float (based on the IEEE Standard 754)? (1 &&0 || !1) 6 38 An unlimited number Question #2 Which of the following is evaluated first: && || ! Question #3 What does 7/9*9 equal (in C and C++)? 1 0.08642 0 Question #4 Question #9 Which is not valid in C? class aClass{public:int x;}; /* A comment */ char x=12; Question #5 Question #10 Which of the following is not a valid declaration for main()? int main() int main(int argc, char *argv[]) They both work True or false: If you continuously increment a variable, it will become negative? True False It depends on the variable type Which is not an ANSI C++ function? sin() kbhit() tmpnam() True False Invalid statement Question #7 Which command properly allocates memory? char *a=new char[20]; char a=new char[20]; char a=new char(20.0); Question #8 What operator is used to access a struct through a pointer? -> >> *
What is the output of the following code: int v() { int m=0; 5 return m++; 1 } 3 int main() { Question #13 cout<<v(); What does the code strcat(an_array, "This"); } do? 1 0 Copies "This" into an_array Code cannot compile Adds "This" to the end of an_array Compares an_array and "This" Question #14 Evaluate the following: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); 10 11 1 Question #15 Evaulate the following: 22%5 2 4 0 Question #18 Which of the following functions initalizes the variables contained in a class: Constructor Destructor Constitutor Question #19 Is C++ case sensitive? No Case sensitivity is compiler-determined Yes Question #20
0 1 Compiler error: Lvalue required Question #22 According to the ANSI C++ standard, what does the getch() do? Reads in a character Checks the keyboard buffer Nothing (getch() is not an ANSI C++ function) Question #23 If the program completes executing successfully, what value should the function main() return? 0 1 void Question #24 C is to C++ as 1 is to What the heck? 2 10 Question #25 Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 Quick Sort Bubble Sort Merge Sort Question #26 What does the following code do: int foo (int x, int y) { cout << x << y ; } int c=0; foo( c++, c ); Undefined 01 00 Question #27 What is the maximum value of an unsigned char? 255 256 128 Question #28 In the following declaration of main, "int main(int argc, char *argv[])", to what does argv[0] usually correspond? The first argument passed into the program The program name You can't define main like that
Question #29 In which header file is isalpha() declared? conio.h stdio.h ctype.h Question #30 What will happen when the following code is run: int x; while(x<100) { cout<<x; x++; } The computer will output "0123...99" The computer will output "0123...100" The output is undefined
{ };
int x; float v;
char array[10];
Page 5 Answers
Question #41 Question #46 What does the following code do? void Evaluate !(1&&1||1&&0) afunction(int *x) { Error x=new int; True *x=12; False } int main() Question #47 { int v=10; What header file is needed for the function exit()? afunction(&v); cout<<v; stdlib.h } conio.h dos.h Outputs 12 Outputs 10 Question #48 Outputs the address of v Question #42 What ANSI C++ function clears the screen?
To what value do nonglobal variables clrscr() clear() default? There is no function, defined by the ANSII C++ standard, which will clear the screen auto register Question #49 static Question #43 When run on a computer, will a recursive function without an end condition ever quit?
Which header file allows file I/O with Compiler-Specific (Some compilers can convert these streams? functions to infinite loops) No iostream Yes fstream fileio.h Question #50 Question #44
What is the outcome of the line of code x=3; x++) "cout<<abs(-16.5);"? Never Three times 16 Forever 17 16.5 Question #45 What value will "strcmp("Astring", "Astring");" return? A positive value A negative value Zero