You are on page 1of 10


e-Quals Diploma for IT Practitioners (Software Development)
Develop software using C++
Sample paper

This paper contains
40 questions.

© The City and Guilds of London Institute 2004

2. Programs are designed a) to provide user documentation b) after testing has been completed c) before a specification is written d) to improve the reliability of the code. Validation is performed to prevent a) invalid input data b) logical errors c) invalid output data d) compilation errors. 6. 2 See next page . 3. 4. The syntax for a comment is a) (*This is a comment *) b) //This is a comment c) /This is a comment / d) */This is a comment/*. 5. An array of structures a) must always be declared globally b) cannot be declared locally c) never uses the structure name in the declaration d) uses a variable name in the declaration. When coding a program a) the design can be adapted b) there should be consistency c) the test plan must be written d) iterations should be avoided. Outcome 2 – Develop software components 7. Indentation is used in code to a) improve its readability b) increase compilation time c) comply with the design specification d) improve its appearance.Develop software using C++ Outcome 1 – Interpret program specifications to develop software 1. Iteration is achieved using a) if b) cout c) switch d) while.

3 See next page . The maximum number of characters that could be stored in the string variable addressLine is a) 43 b) 44 c) 45 d) unlimited. 10. To retain its value between function calls. a local variable must be declared as a) extern b) persistent c) auto d) static.25 c) 33. 9.99 17. A switch statement a) performs iteration on every selection b) must always include a default statement c) uses selection to perform one or more tasks d) can only be used for a maximum of 4 selections.8. char addressLine[45].99.99 14.65 25.25 45.65 d) 45. 12.85 What is the value in the variable costnum after the following statement is executed? costnum = cost[4]. 25. Refer to the figure above.99 4. The array cost holds the following data. a) 4. a /= 5. 11. cout << "a is " << a << endl.55 33. Refer to the figure above.99 b) 25. The output from the code is a) a is 0 b) a is 5 c) a is 7 d) a is 35. int a=35.

Outcome 3 – Use functions 13. float). d) int calcSum(int. d) int funcB(short). b) int calcSum(float. The type of the function prototype is a) long b) float c) char d) int. c) int funcB(float). void printlist(const int list[]). The list parameter is passed so that a) the address of each element is passed b) the data values cannot be altered c) all the data elements are passed separately d) the data values can be altered. 4 See next page . 18. The correct syntax for a function prototype for calcSum that returns an integer and is passed a float and an integer is a) calcSum(int. Which one of the following is an INVALID function prototype to overload the function? a) float funcB(float. float). float. Refer to the figure above. 15. 16. 17. int). A variable passed by value to a function means the function is passed a) the address of the variable b) the address of a pointer to the variable c) a copy of the name of the variable d) a copy of the variable value. int funcB(float. int). int). Refer to the figure above. int). b) float funcB(double. int). c) void calcSum(float. The reference operator & is used in a function prototype to a) specify an address for an array is to be passed b) specify a memory address is to be passed c) specify a value is to be passed d) concatenate two parameters. int). Refer to the figure above. 14. char search(char[].

The value in len after executing the code is a) 0 b) 5 c) 6 d) 7. A user defined header file can be delared as a) #include <”c:\customer. A #define directive can be used to declare a) a function b) a variable c) enumeration types d) a constant 22. Refer to the figure above. b) const RATE 10. The output after executing the code is a) HorshamChurch Road b) Horsham Church Road c) Church Road Horsham d) Church RoadHorsham. A data item of type const is declared a) as an attribute of a class b) with no initial value c) within a function or outside a class d) with a value defined by the C++ language. strcat(street. d) const int=10. char play[25] = {"Hamlet"}.Outcome 4 – Use pre-defined functions 19. 23. c) const int RATE 10. 5 See next page . int len. cout << street.h> d) #include ”c:\customer. char town[31] = {"Horsham"}. char street[20] = {"Church Road "}. 20.lib”> b) #include ‘c:\customer. The correct declaration of a constant named RATE is a) const int RATE = 10. 21. Refer to the figure’ c) #include <c:\customer. len = strlen(play).h” 24.

28. In the hierarchy of file streams a) all file streams are the same level b) fstream is of higher hierarchy than ifstream and ofstream c) both ifstream and ofstream include fstream d) instream takes precedence for all output files. An access mode of "ios::out" is used to a) open a new output file b) open a new input file c) add data to the end of an input file d) add data to the end of an output file. which takes two integer parameters. d) checkValid(int). 26. is a) void checkValid(int. 31. The main components of an object consist of a) attributes / destructors / methods b) interfaces / attributes / methods c) interfaces / attributes / destructors d) constructors / attributes / methods 6 See next page . int). A file object is required as a) it holds the file mode only b) the file will close without it c) it holds the file location and mode d) only the file location is referenced. Which file stream is used to output data to disk? a) Instream b) outstream c) istream d) ostream. b) int checkValid(int.Outcome 5 – Save and retrieve data from disc 25. 30. c) checkValid(int. The declaration for the constructor for a class named checkValid. int). An inline function a) can be accessed only by a friend class b) has its code inserted for every call made to it c) is never executed d) has its code held only once in memory. Outcome 6 – Use object orientated programming (OOP) 29. int). 27.

33. Which one of the following lines of code will cause a syntax error? a) num = ++count1. d) a = b+3+. d) Reading an existing file.56. Outcome 7 – Describe the principles of software testing and management 35. b) Opening a non-existent file. c) Interfacing and integration serve the same purpose. c) float x=10.32. 7 See next page . Which one of the following will cause a run-time error? a) Omitting comments from code. c) Addressing inside the bounds of an array. 36. 38. b=2. Attributes listed in the private area of a class declaration a) must be initialised by a constructor b) cannot be accessed by friend functions c) can be used by all methods of this class d) are available to any derived classes. 37. y =5. a) declaration b) description c) instance d) structure. Object orientated programming a) allows existing code modules to be reused b) does not include encapsulation c) makes all of its data available d) allows encapsulation into multiple entities. 34. b) Components that pass data correctly to each other are interfaced. }. b) int a=195. Which one of the following is TRUE? a) Components that pass data correctly to each other are integrated.75. d) Integration provides a single interface description. A dry run is performed to a) check the design specification is correct b) check the logic of software without a computer c) test that software interfaces correctly d) test that software integrates correctly. The following segment of code shown is a class class equals { public: void validate( ).

Technical documentation is required to a) aid reusability b) make software run faster c) provide user instructions d) decrease development time. End user instructions should always a) include the results of testing b) aid program maintenance c) be compiled during testing d) be clear and unambiguous. 40. 8 See next page .Outcome 8 – Produce documentation 39.

D 27. D 13. D 11. C 12. B 7. B 2. A 4. C 21. D 22.ANSWER KEY Paper number: 7262-23-352 Paper title: Develop software using C++ Question Correct answer 1. B 28. D 14. B 19. A 23. A 17. C 9 See next page . B 15. B 18. C 25. D 24. A 5. C 20. C 16. B 10. C 9. A 26. D 6. D 3. D 8.

29. A 40. B 32. C 34. D 10 See next page . B 39. A 33. A 35. C 31. D 36. B 30. B 38. B 37.