Anda di halaman 1dari 14

Which of the following would be a valid class declaration header for a derived class m, with base classes n and

o? Choose more than one item. The correct options are as follows class m : n, o class m : class n, class o class m : public n, public o class m : public n, o

Identify the true statements about function templates. Choose more than one item. The correct options are as follows All template definitions must be preceded by the eyword !class! The code in a template changes every time the function template is instantiated "very formal parameter in the template definition must appear at least once in the function#s parameter list $ormal parameter names must be uni%ue in the parameter list of a template function

Identify the true statements about passing an ob&ect reference as an argument to a function. Choose more than one item. The correct options are as follows 'ou must prepend the referencing operator ()* when declaring the ob&ect reference in main 'ou must prepend the dereferencing operator (+* when declaring the reference operator in the function prototype 'ou can pass the reference simply by specifying the ob&ect name in the function call In the function, you can use the dot operator (.* to call the ob&ect#s public member functions

What is the purpose of declaring the formal parameter T? Choose an option. The correct option is as follows T specifies that any data sent to the function template must be of type T T is a place,holder for a C-- data type T can only hold a single data type int T can hold any language data type

Which of the following statements are correct? Choose more than one item. The correct options are as follows

When passing an ob&ect to a function, the function argument must be initiali.ed by the ob&ect outside it When returning ob&ects from a function, the ob&ect outside must be initiali.ed from the function argument When returning an ob&ect to a function, the function argument must be initiali.ed by the ob&ect outside it When passing ob&ects from a function, the ob&ect outside must be initiali.ed from the function argument

Which of the following statements describes what the see p(* function does? Choose an option. The correct option is as follows It enables an instance of an istream class ob&ect to indicate the byte number in the file from which the ne/t input is to occur It enables the pointer of an ostream class ob&ect to indicate the byte number in the file from which the ne/t output is to occur Which function must be included in all C-- programs? Choose an option. The correct option is as follows 0include main(* cin cout

A base class has public functions that allow its private lin pointer to be accessed and reassigned, but lin ed list nodes are instantiated from a derived class. Which of the following tas s can be performed using a reference to the base class? Choose more than one item. The correct options are as follows 1ynamically allocating memory for the node Adding the node to the lin ed list 2emoving the node from the lin ed list $reeing the memory used by the dynamically created ob&ect

Identify the true statements about software component reusability. Choose more than one item. The correct options are as follows $unctions can be compiled separately even if they are not in different files $unctions always allow information hiding 2eusable components are fle/ible and robust for e/tension and speciali.ation 2eusable components have a simple interface to encourage other programmers to use them without modification

What happens if a program encounters a fatal error, and the programmer has not provided a means of handling the error? Choose an option. The correct option is as follows The error is ignored The program terminates The line of code in which the error is encountered is ignored, and the program continues with the ne/t line

What is it that you must include the appropriate name of in your program so that you can use any function in the library? Choose an option. The correct option is as follows 3rogram file 4in file 5eader file 1irectory

Identify the eyword that can be used in a function to force control bac to the function call before the entire function has been run. Choose an option. The correct option is as follows brea switch return continue

When you now in advance the number of times a statement bloc should e/ecute, which loop structure should you use? Choose an option. The correct option is as follows $or loop While loop 1o6while loop What do you need to create in order to create and access dynamically allocated memory? Choose an option. The correct option is as follows

An ob&ect A string A dynamic variable A pointer Which options about inheritance are true? Choose more than one item. The correct options are as follows 7ingle inheritance means that the derived class inherits elements from more than one base class 8ultiple inheritance means that the derived class inherits elements from one base class 8ultiple inheritance means that the derived class inherits elements from more than one base class 7ingle inheritance means that the derived class inherits elements from one base class What type of lin age does global variables and functions not preceded by static have? Choose an option. The correct option is as follows Internal Intern "/ternal "/tern What do a lin ed list#s nodes correspond to in an array? Choose an option. The correct option is as follows 9alues "lements 7ubscripts 7i.e Which of the following descriptions about a stream is true? Choose an option. The correct option is as follows A stream is made up of a number of records A stream is an ob&ect used for generic I6: A stream is a field with a fi/ed length A stream is a field used for generic I6: Which statements should you follow when you declare a class? Choose more than one item. The correct options are as follows All members should be defined as public, private, or protected 8embers that have the same access control should be ept together

1ata members should be directly initiali.ed 'ou must define an instance of a class separately from the class declaration Identify the true statements about a single lin ed list in which nodes are added at the head. Choose more than one item. The correct options are as follows The lin pointer of the first node added to the list always has a ;<44 value The new node should be stored at the memory address of the e/isting head The value of the head pointer should change every time a node is added to the list :nce a dynamically created ob&ect becomes a node, the pointer used when creating it can have its value changed without the node being lost Which operator can you use to access public static class members through any ob&ect of that class and through the class name? Choose an option. The correct option is as follows The scope resolution operator (::* The dot operator (.* The pointer,to operator (,=* When can unary and binary operators be declared as member functions? Choose an option. The correct option is as follows When the operand of a binary operator is an ob&ect of that class or when the left operand of a unary operator is an ob&ect of that class When the operand of a unary operator is an ob&ect of that class or when the left operand of a binary operator is an ob&ect of that class When the operand of a unary operator is an ob&ect of that class or when the operand of a binary operator is an ob&ect of that class What is the advantage of declaring the constructor and destructor functions for public member access? Choose an option. The correct option is as follows It allows the constructor and destructor access to the data members It means that the constructor and destructor can be called directly by code in the main(* function It allows the constructor and destructor access to the other member functions

What type of operator is ))? Choose an option. The correct option is as follows 2elational

4ogical "%uality

Identify the statements that are true of member functions. Choose more than one item. The correct options are as follows A member function has no arguments for overloaded unary operators A member function has two arguments for overloaded binary operators "ach member function is automatically assigned a pointer called this The this pointer points to the address of the last ob&ect in the class

Which of the following must member functions, declared in a class, have in the header of their definitions outside the class? Choose an option. The correct option is as follows 1ot operator (.* 7cope resolution operator (::* Arrow operator (,=*

What is a memory location that is shared by two or more different variables, at different times? Choose an option. The correct option is as follows A structure A union member A union A structured member What type of lin age does global variables and functions preceded by the storage class specifier static have? Choose an option. The correct option is as follows Internal Intern "/ternal "/tern 5ow is the casting operator called when the compiler sees a user,defined type being used where another type is re%uired? Choose an option. The correct option is as follows

Implicitly "/plicitly Implicitly or e/plicitly Which of the following lines of code opens the invoice file for output and binary operations? Choose an option. The correct option is as follows open(!invoice!, ios::binary, ios::out* open(!invoice!, out::binary* open(!invoice!, ios::out>ios::binary* open(ios::out, !invoice!, ios::binary* Identify the true statements about header files. Choose more than one item. The correct options are as follows When the preprocessor encounters an 0include statement, it inserts the contents of the specified header file at the location of the statement If a filename is specified in angle brac ets (?=*, the preprocessor loo s for that file in a specified search path $unction prototypes are usually contained in the same header file as their definitions The 0include statements must be the first items specified in a source file

If a derived class does not supply a definition for a pure virtual function that is declared in its base class, what happens to that function in the derived class? Choose an option. The correct option is as follows It is ignored It becomes concrete It remains pure

What ind of scope does a variable declared outside any function have? Choose an option. The correct option is as follows @loc scope $ile scope $unction scope $unction prototype scope

Which of the following is e/ception handling designed to deal with? Choose more than one item. The correct options are as follows

7ynchronous situations, such as an attempt to divide by .ero Asynchronous situations such as dis I6: completions 4ibrary function errors Conventional program control

5ow many operands does a throw statement normally specify? Choose an option. The correct option is as follows :ne Two Three $our

What does the following derived class header mean? Choose an option. class / : public y, public . A The correct option is as follows class / is a derived class with no access to the public members of the base class y class y is a derived class with public access to all of the members of the base class / class / is a derived class with access to the public members of base classes y and .

Identify the conditional preprocessor directives. Choose more than one item. The correct options are as follows The 0if directive The 0elseif directive The 0elif directive The 0ifdefn directive

$or which of the following purposes can a this pointer be used? Choose more than one item. The correct options are as follows Initiali.ing an ob&ect pointer in a class member function 3assing an ob&ect pointer when calling a global function from a class member function 3assing an ob&ect pointer from 8ain(* to a global function "nsuring that member functions perform operations using the correct ob&ect#s data members

Identify the statements that are true of the following code fragment: C:b&ect +p:b&ect B (C:b&ect +* new C2ecordC if (p:b&ect BB ;<44*A returnC D Choose more than one item. The correct options are as follows The p:b&ect pointer is not of the same type as the ob&ect being dynamically created @ecause a cast is used, the dynamically created ob&ect is of type C:b&ect A valid reference to a C2ecord ob&ect is created, assuming C2ecord is derived from C:b&ect 8emory allocation failed

Assume that a class contains a head pointer that can be accessed through public functions. 5ow could you ensure that the entire program has consistent access to the head of the list? Choose an option. The correct option is as follows Instantiate the class in every function that needs to use the head pointer 8a e the class a friend of the node class Create one instance of the class in main(* and pass the ob&ect#s memory address to it 1eclare each instance of the class as a const

Which of the following header definitions would you use to allow the public members of base class E to be inherited as public members in derived class '? Choose an option. The correct option is as follows class ':private EA class ':protected EA class ':EA class ':public EA

Which of the following statements are correct? Choose more than one item. The correct options are as follows "/isting operators are used to manipulate pre,defined data types :verloaded operators are used to manipulate pre,defined data types "/isting operators are used to manipulate user,defined data types :verloaded operators are used to manipulate user,defined data types

What type of class template can be nested? Choose an option. The correct option is as follows :nly non,template classes :nly class templates @oth class templates and non,template classes ;either class templates nor non,template class

Assuming a successful attempt at dynamic memory allocation, what is the new eyword#s return value? Choose an option. The correct option is as follows T2<" A copy of a variable A variable#s value(s* A memory address

7elect the statements which are true of C--. Choose more than one item. The correct options are as follows C-- comments can be single,line or multi,line and are ignored by the compiler C-- programs contain one or more functions, one of which will be the main(* function The main(* function must be the first function in the program "very variable has a name, a type, a value, a si.e, and a lifetime

Identify the true statements about a lin pointer. Choose more than one item. The correct options are as follows Its value should be changed only if the lin ed list#s head changes It is a self,referential class data member It is used to reference a node in a lin ed list If it belongs to the last node in the list, it should have a ;<44 value

Which type of scope means that the ob&ect is visible throughout the whole file? Choose an option. The correct option is as follows $ile 4ocal

Class $unction

Which type of function should you include in the class definition to form an abstract class? Choose an option. The correct option is as follows Concrete 7tatic 9irtual 3ure virtual

Which options are true of stream manipulators? Choose more than one item. The correct options are as follows To use manipulators, you need only to include iostream.h as a header in your C-- program To use manipulators, you need only to include iomanip.h in your program 7tream manipulators are special functions which can be included in an I6: e/pression endl is a stream manipulator

Which of the following statements enables a program to open and read from the orders file? Choose more than one item. The correct options are as follows p$ile,=open(!orders.bin!, ios::in*C p$ile,=open(!orders.bin!, ios::out>ios::binary*C p$ile,=open(ios::in, !orders.bin!, ios::binary*C p$ile,=open(!orders.bin!, ios::in>ios::binary*C

Identify the true statements about function prototypes. Choose more than one item. The correct options are as follows They must be placed in separate header files They must be declared before the function is called A synta/ error is generated if the function prototypes does not match the function definition header The compiler uses function prototypes to validate function calls

What is the outcome of the following code if a numeric value with a decimal point is entered? Choose more than one item.

int nIntegerC cin == nIntegerC The correct options are as follows The result returned for the variable will be undefined The program s ips the line that contains the code that performs this operation and continues with the ne/t line An error message is automatically displayed The stream ob&ect flags an error

When a variable is declared in a bloc of code, where can it be referenced? Choose an option. The correct option is as follows :nly in that bloc In that bloc or in bloc s nested within the code $rom anywhere in the code In or outside that bloc

Which of the following statements are true about writing an integer to a file? Choose more than one item. The correct options are as follows The write(* function must to locate it The write(* function must of storage needed for it The write(* function must locate it The write(* function must now the e/act location of the integer and the address operator ()* enables it now the si.e of the integer and the address operator ()* returns the amount now the e/act location of the integer and the si.eof operator enables it to now the si.e of the integer and the si.eof operator enables it to locate it

Which of the following statements are true of programs that read from a file and write to a file? Choose more than one item. The correct options are as follows A program that reads from a file creates a stream ob&ect but a program that writes to a file does not @oth programs that read from a file and write to a file create a stream ob&ect @oth programs that read from a file and write to a file open a file The program that reads from a file uses the ifstream class and ob&ect The program that writes to a file opens a file for input operations

7elect the statements, which are true of C and C-- when you want to mi/ C and C-- code. Choose more than one item. The correct options are as follows 'ou can include a standard C header file in your C-- code 'ou can include a non,system C header file in your C-- code When using C functions in C--, you use lin age specifications to allow the function name to be encoded by the C-- compiler When using C in C--, you precede the function prototypes with struct Assume that the following statement is included in a source file: 0include !math.h! Where does the preprocessor search for the file math.h? Choose an option. The correct option is as follows In all directories on the current drive In all directories in all available drives In the current directory In the standard library directory

7elect the statements which are true of the C-- language. Choose more than one item. The correct options are as follows C-- is a strongly typed language C-- is an e/tension of C, but does not incorporate ob&ect,orientation principles C-- development systems consist of a te/t editor, a compiler, a standard library, class libraries, and a debugger To generate a C-- program you must edit, preprocess, compile, and lin your code

Which of the following are valid array declarations? Choose more than one item. The correct options are as follows int array;ameFGHC short array;ameFIJHC int array;ameFKHBAL,G,M,N,O,PDC char c7tringFH B 5elloC char cstringFH B A#5#,#e#, #l#, #l#, #o#, #QJ#DC

Which type of data does a write statement e/pect? Choose an option. The correct option is as follows short int

const char + char constant int

Which statement about member functions is true? Choose an option. The correct option is as follows A member function must be defined within the class A member function must be defined outside the class A member function can be defined inside or outside the class

Anda mungkin juga menyukai