You will get email Reply within few hours

Thursday, 25 April 2013

C++ Final

1. (TCO 13) The header file that defines the classes for processing and manipulating files is called the _____. (Points : 4)
      <iostream>
      <fstream>
      <pstream>
      <mstream>

2. (TCO 13) What do the following statements accomplish?
ofstreamtheFile;
theFile.open( myFile.txt , ios::out); (Points : 4)
      Opens myFile in read mode
      Opens myFile in append mode
      Creates an empty file named myFile
      Opens a file in input mode to write to

3. (TCO 13) When a file is opened in the append mode, the file pointer is positioned _____. (Points : 4)
      at the end of the file
      at the beginning of the file
       in the middle of the file
      after the file header

4. (TCO 13) Which of the following functions should be used to determine if a file was successfully opened? (Points : 4)
       is_active
       is_open
       is_closed
       is_ready

5.
(TCO 12) Assuming that t is an array and tPtr is a pointer to that array, which expression refers to the address of element 3 of the array? (Points : 4)
       *( tPtr + 3 )
      tPtr[ 3 ]
      &t[ 3 ]
      *( t + 3 )

6. (TCO 11) N-1 is the _____. (Points : 4)
      first position of an array
       position of Row
       position of Column
       last position of an array

7. (TCO 11) Programmers often mistakenly reference the first element in an array with index1. What is this called? (Points : 4)
       Logic-error
       Index1-error
      Off-by-one-error
      N-1

8. (TCO 11) In the following array, what is the value of table[2][1]?
int table[4][3]={3,7,0,2,4,9,8,1,3,6,5,4};
(Points : 4)
       4
       7
       6
       1

9. (TCO 10) Bug errors are _____ errors. (Points : 4)
      asp.net
      syntax
       binary
      logic

10. (TCO 9) The procedures that the object performs are known as _____. (Points : 4)
       records
       functions
       addresses
       data fields

11. (TCO 9) What is the term used for the fields and methods that belong to a class? (Points : 4)
       Body
      Definition
       Return
       Members

12. (TCO 9) The word Private that appears before a field declaration, in a class definition, is known as a(n) _____. (Points : 4)
      access specifier
      specifier
       class specifier
       None of the above

13. (TCO 9) Which method is called automatically when an object is created? (Points : 4)
      Accessor method
      Mutator method
      Constructor method
      Destructor method

14. (TCO 8) A value included in a function call that is passed to a function is called a(n) _____. (Points : 4)
      argument
      parameter
      initializer
      reference

15. (TCO 7) Typically, the last statement in a value-returning function is a _____. (Points : 4)
      body
      header
      return statement
      void statement


1. (TCO 7) What is a variable's scope? (Points : 4)
      The length of time the variable is in existence
      Determines who can see and access the variable
      It is the length of time the variable is in existence, AND determines who can see and access the variable.
      None of these

2. (TCO 7) Why is it not necessary to pass a global variable to a function? (Points : 4)
      You have to pass global variables to functions.
      main() passes them for you.
      All functions defined after the global variable definition can see and access global variables.
       They remain local to main().

3. (TCO 6) If there are errors in the executable code and it needs to be run one step at a time to find the errors, what development tool should be used? (Points : 4)
      Debugger
      Compiler
      Linker
      Common language runtime

4. (TCO 5) Float and double variables should not be used _____. (Points : 4)
      as counters
      to perform mathematical calculations
      as approximate representations of decimal numbers
      for applications when precision is required

5. (TCO 5) The most difficult aspect of working with _____ loops is keeping track of the separate loop control variables that direct the program's execution. (Points : 4)
       nested
      controlled-counter
       outer
      counter-controlled

6. (TCO 5) How many times will this for loop execute?
for (inti = 100; I > 0; --i) (Points : 4)
      0, the loop will not execute
      99
      100
       The loop is not written correctly. It would not compile.

7. (TCO 4) When an if statement is placed within the conditionally executed code of another if statement, this is known as _____. (Points : 4)
      complexity
      nesting
      overloading
      validation

8. (TCO 4) Consider the following segment of code.

if(apple != Orange)
     cout<<"You got Oranges!"<<endl;
else
     cout<<"You got Apples";
cout<<"The end of the program is reached.";

What error can you identify? (Points : 4)
      A double quotation mark was incorrectly inserted.
      You cannot compare apples to oranges.
      Assumes indentation has a logical purpose
     No error

9. (TCO 4) Why are break statements needed inside a switch's case statements? (Points : 4)
       The break statements cause the program to jump out of the switch.
       The case label is needed so that the switch finds the correct condition.
       The break statements separate the case statements.
       None of these statements explain why a switch needs break statements.

10. (TCO 3) What is the value of x after the following statement?
float x;
x = 3.0 / 4.0 + 3 + 2 / 5 (Points : 4)
       1.75
       5.75
       3.75
       4.15

11. (TCO2) What symbol terminates a statement? (Points : 4)
       //
       ;
      \\
      >>

12. (TCO 2) C++ program source code files have which file extension? (Points : 4)
       .cpp
       .h
       .txt
       .doc

13. (TCO 2) _____ is/are used to document what a program, function, or statement accomplishes and will be ignored by the compiler. (Points : 4)
       Source code
       Debugging notes
       Comments
       Output documentation

14. (TCO 1) Microsoft Visual C++ is an example of a(n) _____. (Points : 4)
       C++ programming language
       IDE
       compiler
      debugger

15. (TCO 2) The following program displays: _____.
#include
using namespace std;

int main()
{
 cout<< "C++ is FUN"<<endl;
return 0;
} (Points : 4)
      C++ is NOT FUN
       C++ is FUN
       C++ is Fun
       C++ is fun
1. (TCO 3) What is the output of the following program?
#include <iostream>
using namespace std;
int main()
{
     int x1, x2, i, j, k, y, z;
     float f;
     x1 = 1;
     x2 = 1;
     y = 5 + x1--;
     z = 5 + ++x2;
     i = 6 % 4;
     j = 1;
     j += j + 3;
     k = 25 / 2;
     f = (float)((2 / 5) * k);

     cout<<"x1 is "<<x1<<"\nx2 is "<<x2<<"\ni is "
            <<i<<"\nj is "<<j<<"\nk is "<<k<<"\nk is "
            <<k<<"\ny is "<<y<<"\nz is "<<z<<"\nf is "<<f<<endl;
     return 0;
}


2. (TCO 4) When using a logical AND (or a logical OR), are the expressions to both sides of the && (or ||) always evaluated? Please explain. (Points : 15)
 
3. (TCO 5) Using a loop, write a program that reads in exactly five integers and outputs the sum. (Points : 15)
 

4. (TCO 7) Explain the difference between a function prototype and a function definition. Use a C++ program segment to illustrate your answer. (Points : 15)
 
5. (TCO 11) Explain how a linear search is conducted to find a particular data value in an array. Provide a C++ program segment to illustrate your answer. (Points : 15)

6. (TCO 9) Define objects, class, method, and proprieties and provide code segment that illustrates these terms. (Points : 15)


7. (TCO 13) Create a writeData method snippet of code using NAME and State as variables. Collect the information and write it to file. (Points : 20) 
Need Solution Click link:
https://gum.co/fBEc
          OR email me

topsolutions8@gmail.com