Finishing School – 2011 Computer Science C Questions 1. Which symbol is used to make comments ? // # !! <!-2. How would you insert pre-written code into a current program ? #read <file> #get <file> #include <file> #pre <file> 3. Which symbols represent a block of code ? { ... code here } ( ... code here ) [ ... code here ] < ... code here > 4. In which standard library file is the function printf() located ? stdlib.h stdio.h stdout.h stdoutput.h 5. In order to properly use a variable... The variable must have a valid type. The variable name can not be a keyword (part of the C syntax). The variable name must begin with a letter. All of the above. 6. Which mathematical operators are in the correct order ? Addition, Division, Modulus Division, Multipication, Modulus Modulus, Multipication, Subtraction Modulus, Addition, Division 7. Which of the following are NOT relational operators ? > < == >= 1 8. The first expression in a for loop is The test expression. The step value of the loop. The value of our counter variable. None of the above. 9. What is the break statement used for ? To quit the program. To quit the current iteration. To stop the current iteration and begin the next iteration. None of the above. 10. What is the continue statement used for ? To continue to the next line of code. To stop the current iteration and begin the next iteration from the beginning. As an alternative to the else statement. None of the above. 11. A function prototypes are useful Because they tell the compiler that a function is declared later. Because they make the program more readable. Because they allow the programmer to see a quick list of functions in the program along with the arguments for each function. All of the above. 12. Because of variable scope Variables created in a function cannot be used another function. Variables created in a function can be used in another function. Variables created in a function can only be used in the main function None of the above. 13. Which symbol is used to declare a pointer ? & @ * $ 14. Which symbol is used to reference a pointer ? * & @ $ 2 15. Adding to a pointer that points to an array will Cause an error. Increase the value of the element that the pointer is pointing to. Cause the pointer to point to the next element in the array. None of the above. 16. To access the members of a structure, which symbol is used ? * , . 17. A member is a Variable in a structure. Structure's datatype. Pointer to a structure. None of the above. 18. Structures can... Hold many variables of different types. Have pointers to structures. Be assigned to one another, given they are the same type. All of the above. 19. In a C program, the first statement that will be executed is: The first executable statement of the program. The first executable statement of the main() function. The first executable statment after the comment /*start here*/ The first executable statement of the end function. 20. The statement: int *jack Declares that all variables ending with jack are ints. Is a pointer declaration. jack is a pointer to an int variable. Declares that jack is the address of a variable and that the address is an int. Declares that all variables starting with jack are ints. 3 C ++ - Questions 1. What function initalizes variables in a class: Constructor Destructor Constitutor A and B are correct. 2. To include code from the library in the program, such as iostream, a directive would be called up using this command. #include <>; with iostream.h inside the brackets include (iostreamh) #include <> with iostream.h inside the brackets include #iostream,h; 3. Single line comments explaining code would be preceded like in the following example /** // *// /* 4. Which line has all reserved words ? char, int, float, doubled, short, long, unsigned, signed sizeof, const, typedef, static, voided, enum, struct, union if, else, for, while do, switch, continue, break defaulted, goto, return, extern, private, public, protected 5. What punctuation must each command line have at the end of the line ? : , ! ; 6. The C++ language is case-sensitive. Not case-sensitive. It depends None of these 7. The number 5.9875e17 must be stored in a(n): int long double float 4 8. Select the correct definition for a string variable. string mystr; string mystr[20]; string[20] mystr; char mystr[20]; 9. The sentence "Hello world!" uses _____ elements in a character array. 10 11 12 13 10. When you are creating a structure, you need to use the following keyword structure struct object record 11. Select the correct function definition (NOT prototype) from the list below. void intro(); double sin(double rad); int foo(int bar; double baz) double pow(double num, int pow); 12. Cout can print multiple values or variables in a single command using the following syntax: cout << "Hi" + bob + "\n"; cout << "Hi" << bob << "\n"; cout << "Hi", bob, "\n"; cout << ("Hi" & bob & "\n"); 13. Write a for loop that counts from 0 to 5. for (c = 0; c <= 5; c++) for (int c = 0; c <= 6; c++) for (c = 0; c < 5; c++) for (c = 0; c < 5; c++); 14. What does the statement #include do ? It defines the function iostream.h It tells the compiler where the program begins It defines the words TRUE and FALSE It allows the programmer to use cout << It defines the statement return 5 15. Which of the following converts an integer "value" to its ASCII equivalent ? atoi(value) cout << value (char) value char (value) 16. Indicate which data type is not part of standard C++. bool int real double 17. Which one of the choices would produce the following output ? cout << "Hello" << "World"; cout << "Hello \n World"; cout << "Hello World\n"; cin >> "Hello World"; 18. What is the output of the following code? for (int i=0; i<10; i++); cout << i%2 << " "; } 0123456789 0 2 4 6 8 10 12 14 16 18 1010101010 0101010101 19. What is the output of the following code? for (int a = 1; a <= 1; a++) cout << a++; cout << a; 22 12 error 23 20. For which values of the integer _value will the following code become an infinite loop? int number=1; while (true) { cout << number; if (number == 3) break; number += _value; } only 0 only 1 only 2 only 1 or 2 6 VB Questions 1. VB is: Visual Building Visual Basic View Building View Basic 2. What is the function of this button ? Run the project View Form Height of window View the source code 3. Which of these is not an collection of the VB project ? The global module The form module The object module The class module 4. What is the name of the bar where you would see a Categorized view or a Alphabetic View ? Project Properties Window Tool Bar Tool Box window Project explorer 5. On start up, which of these window is not displayed ? The Blank Form window The Class window The Project window The Properties window 6. What is this button used for ? Stopping other programs taking inputs Terminating the application Drawing 3d objects Check the application 7. Message boxes are used for when you want to ask the user a question display an error message advise the user All the above 7 8. Which one of these is not a valid add -in ? global module resource files general module modest module 9. How many types of message boxes are there in VB ? 5 6 7 8 10. What is tool tip text ? Tool tip text is a tip of the day Tool tip text does not exist Tool tip text is shown when the mouse is held over a object for a period of time Tool tip text is the same as the caption 11. Which of these is not an vaild messagebox in VB ? vbOKonly vbExitOnly vbAbortRetryIgnore vbRetryCancel 12. What is the meaning of *.VBP ? Volly Ball Practice Visual Binary Protocol Visual Basic Project Visi - ble - property 13. A control array is a list of controls with the defferent names same name both 1 and 2 None of these 14. What is the purpose of the name function in all controls ? So things can be sorted by type So they can be called at runtime The name functions does not exist Not too sure 8 15. What is DAO ? Database Access Object Data Advanced Object Data Access Objects None of these 16. Which of these is used to open an database ? Set dbMyDB = OpenDatabase("MyDatabase.mdb") dbMyDB = OpenDatabase("MyDatabase.mdb") Set dbMyDB = OpenDatabase None of these 17. Visual Basic uses an object called ______ to hold your table. Record RecordSet file table 18. The Visual Basic Upgrade Wizard will convert all the code in your VB 6 application to VB.NET code for you. True False Not always true None of these 19. If you know you want to migrate your Visual Basic 6 application to VB.NET, what is the first thing you should do ? Open the Visual Basic Upgrade Wizard, get a cup of coffee and watch it run. Assess the VB 6 application; find out what controls it uses, what projects are in there and so on. Cancel all social plans for the next couple months and start rewriting the app in .NET. Schedule meetings with end users to see what features they want to add to the app. 20. Some bits of a Visual Basic 6 application, like most APIs, can be easily migrated to VB.NET; other parts are not so straightforward. Which of the following will NOT have to be re-architected during a VB 6-to-VB.NET migration ? DHTML pages ActiveX documents OLE controls ADO to ADO via Interop 9 Data Structures Questions 1. _____________ Memory is Volatile main Random Access Both 1 and 2 Virtual 2. An _________ data type is a keyword of a programming language that specifies the amount of memory needed to store data and the kind of data that will be stored in that memory location abstract int vector None of these 3. Which of the following abstract data types are NOT used by Integer Abstract Data type group? Short Int float long 4. The hashString() member function is called by other member functions of the Hashtable class whenever a function needs to convert a ________________ a hash number key to a key key to a hash number key a key to an Index None of these 5. An application iterates the hashtable by calling the ______ and ______ member functions hasNext() and hasDelete() hasNext() and getNextKey() Both 1 and 2 None of these 6. The java.util package contains two classes that are designed to work with hashtables. They are _______ and _________.. Hashtable , HashMap class Hashtable,List Vector,List Vector,Hashtable 7. Data members of the Hashtable class stored in the private access specifier private access specifier Public access specifier common access specifier None of these 10 8. _____ is the common programming technique used for hashing in all hashing functions Cloning Bit Shifting Hashmapping Listing 9. If the depth of a tree is 3 levels, then what is the Size of the Tree? 4 2 8 6 10. deleteNode() function requires the _____ of the data element of the node that is being removed reference value declaration variable 11. Value of the first linked list index is _______ One Zero -1 None of these 12. A linked list index is ____ that represents the position of a node in a linked list. An Integer a variable a character a boolean 13. Why is the constructor of the QueueLinkedList class empty? because initialization of data members of the LinkedList class is performed by the constructor of the LinkedList class. because initialization of data members of the LinkedList class is performed by the destructor of the LinkedList class. because initialization of data members of the QueueLinkedList class is performed by the constructor of the LinkedList class. because initialization of data members of the QueueLinkedList class is performed by the destructor of the LinkedList class 14. _______ form of access is used to add and remove nodes from a queue LIFO,Last In First Out FIFO , First In First Out Both 1 and 2 None of these 11 15. ______ form of access is used to add and remove nodes from a stack LIFO FIFO Both 1 and 2 None of these 16. New nodes are added to the _____ of the queue. front back middle Both 1 and 2 17. A _______ is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out. queue linked list stacks linked list both of them neither of them 18. In an array queue, data is stored in an _____ element. Node linked list array constructor 19. The pop() member function determines if the stack is empty by calling the _____ member function removeback() isEmpty() removedfront() hasNext() 20. What happens when you push a new node onto a stack? the new node is placed at the front of the linked list. the new node is placed at the back of the linked list. the new node is placed at the middle of the linked list. No Changes happens 12 Networking – Questions 1. The maximum number of nodes per segment depends on the_______.? Bandwidth Desired throughput Regeneration ability Attenuation 2. Information can be transmitted via one of_______siganlling method(s). One Two Four Five 3. IEEE designates Thicknet as_______Ethernet 10Base5 10BaseT 10Base10 10Base2 4. ensure(s) that data are transferred whole, in sequence, and without error from one node on the network to another. Data Packets Addressing Protocol File services 5. Which is not an exmple of transmission media? Wire Coaxial cable Radio waves None of the above 6. Mail services requires a significant commitment of technical support and administration and resources due to their Instability Access ability Routing capability Heavy use 7. How many layers in the OSI model? 5 7 6 8 8. Which device act as a traffic cop? Router Hub Switch Modem 9. What is SMTP? Simple Mailer transport protocol Simple mail transport protocol Single Mail transport protocol Noneofthese 10. An organization that share devices, saves Money Time Space All of the above. 13 JAVA 1. What is Java (in regard to Computer Science) ? A type of coffee An interactive website An object-oriented programming language None of the above 2. What is an Applet ? Type of computer An interactive website A Java program that is run through a web browser A type of fruit 3. Java runs on _______. Windows Unix/Linux Mac All of the Above 4. Why can't the whole program just consist of the one line that does the painting ? In Java, to create an applet, you can't call on functions without defining a class to call them. To appear on the web, Java must use an applet, and without first defining a class, you won't be painting onto anything. The drawString function is not defined without the "import" statements at the top. All of the above. 5. What's the difference between an Applet and an application ? An application is only available on Windows Applets are run over the web. Applets can paint words, applications cannot. None of the above. 6. What is the main function of any variable ? To add numbers together To print words on the screen To keep track of data in the memory of the computer To write Java 7. What is the proper way to declare a variable ? variableName variableType; variableType; variableName; variableType variableName; 8. Booleans are _______. True or False Single characters Text All numbers 9. The following statements make “length” be what number ? int length; length = 4; length ++; 4 5 6 8 10. What is an assignment statement ? Adding a number to an int Assigning a multiplication Assigning a name to a variable Assigning a value to a variable 14 Finishing School - Computer Science - Answer Booklet C 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. C ++ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. VB 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. NETWORKING 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Data Structures 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. JAVA 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 15 Answers C Answers 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. a c b b d c c c b b d a c b c d a d b b VB Answers 1. b 2. d 3. c 4. a 5. b 6. b 7. d 8. d 9. b 10. c 11. b 12. c 13. b 14. b 15. c 16. a 17. b 18. c 19. b 20. d NETWORKING- ANSWERS 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. d b a c d d b a b d C ++ Answers 1. a 2. c 3. b 4. c 5. d 6. a 7. c 8. d 9. d 10. b 11. d 12. b 13. a 14. a 15. a 16. c 17. d 18. c 19. a 20. b Data Structures - Answers 1. c 2. a 3. c 4. b 5. b 6. a 7. a 8. b 9. c 10. b 11. b 12. a 13. a 14. b 15. a 16. b 17. a 18. c 19. b 20. a JAVA- answers 1. b 2. b 3. d 4. d 5. c 6. b 7. d 8. a 9. b 10. d 16