Tuesday 21 May 2013

QUIZ 26-30 ANSWERS

26. 
_____ variables remain in memory until the program ends
Area
Global
Local
Reference
Value
Answer: Option B

27.
The outline or the definition of a function is called its
beta test
Forerunner
Outline
Prototype
Answer: Option D

28. 
Which of the following is false?
Data stored in an array can be accessed faster than data stored in a disk file
Data stored in an array needs to be entered only once, typically at the beginning of the program
Arrays allow the programmer to store information in the computer's internal memory
When using arrays, you will have fewer variable names to remember
None of the preceding statements are false
Answer: Option E

29. 
A function typically contains
the function header
the function braces
the return statement, if it's value- returning function
a display message
All of the above
Answer: Option E


30. 
A variable's _____ indicates which portions of the program can use the variable
Area
extent
Lifetime
reach
scope
Answer: Option E

Monday 20 May 2013

QUIZ 21-25

21. 
A group of related fields that contain all of the data about a specific person, place, or thing is called a
data file
field file
program file
Record
Answer: Option D

22. 
To send output to a file, you need to include the _____ header file in your program
file.h
fstream.h
iomanip.h
iostream.h
of stream.h
Answer: Option B

23. 
A C++ _____ is a program that runs in a DOS window
Algorithm
cast application
console application
source application
Answer: Option C

24. 
A difference, between reference variables and pointers is that
reference variables are easier to use
pointers are easier to use
reference variables are more flexible
no difference exists between reference variables and pointers
Answer: Option A



25. 
A 'C function does not contain
a function header
argument declarations
other 'C' functions
function body
None of the above
Answer: Option C

Thursday 16 May 2013

Find output

#include <stdio.h>
int main()
{
int mar[5]={0,1,2,3,4};
int j,m,i;
i=++mar[0];
j=mar[1]++;
m=mar[i++];
printf("%d %d %d\n\n", i,j,m);
return 0;
}


Answer: i=2, because you increment it in m=mar[i++], j = 1, because the increment carried out after the assignment and m=2, because m=mar[2] => 2 1 2

Friday 10 May 2013

QUIZ ANSWERS 16-20

QUIZ ANSWERS 16-20

16. 
The generic type in a template function
must be T
can be T
cannot be T for functions you create, but may be for C++'s built-in functions
cannot be T
Answer: Option B


17. 
A function that is called automatically each time an object is destroyed is a
Constructor
destructor
Destroyer
terminator
Answer: Option B

18. 
A function can
return a value
perform a task
change value of actual arguments in call by reference
a, b, c above are all true
None of the above
Answer: Option D


19. 
The statement float values[]={3.14, -7.86, 36.96, 4.87};
assigns 36.96 to values[2]
assigns -7.86 to values[2]
gives an error message
assign 14 to values[2]
Answer: Option A


20. 
When the compiler places a copy of a small function's statements directly into a program, the function is said to be _____
Overloaded
mangled
inline
redundant
Answer: Option C

Thursday 9 May 2013

QUIZ ANSWERS 11-15

QUIZ ANSWERS 11-15

11.
A function that returns no values to the program that calls it is _____
not allowed in C++
type void
type empty
type barren
Answer: Option B


12. 
The keyword used to define a structure is _____
Stru
stt
Struct
structure
Answer: Option C

13. 
Which of the following statements is false?
A function is a block of code that performs a specific task
Functions allow programmers to break large and complex problems into small and manageable tasks
Functions allow programmers to use existing code to perform common tasks
Functions can be called, or invoked, only once in a program
Programmer-defined functions can be either value-returning or void
Answer: Option D

14. 
Header files often have the file extension _____
.H
.HE
.HEA
.HEAD
Answer: Option A

15. 
The #ifndef directive tests to see whether ________
a class has been defined
a variable has been given a value
a class has no variable definitions
any objects of the class have been instantiated
Answer: Option A

#ifndef checks whether the given token has been #defined earlier in the file or in an included file; if not, it includes the code between it and the closing #else or, if no #else is present, #endif statement#ifndef is often used to make header files idempotent by defining a token once the file has been included and checking that the token was not set at the top of that file.