Question

These are my answere to the following questions: are they right? 1. B 2. T 3....

These are my answere to the following questions: are they right?
1. B
2. T
3. T
4. T
5. F
6. T
7. A
8. D
9. E
10. B
11. B
12. A
13. A
14. D
15. C
16. D
17. T
18. C
19. T
20. T
21. T
22. A
23. T
24. D
25. B
26. A
27. A
28. A
29. T
30. C
31. D
32. A
33. T
34. F
35. T
36. T
37. T
38. T
39. D
40. B
41. T
42. T
43. F
44. T
45. T
46. T
47. T
48. B
49. F
50. F

1. The operators: &  |  ^  are:

a) AND OR NOT
b) AND OR XOR
c) AND NOT NAND
d) AND NOR XOR
e) none of these

2.  Strings are objects, not types. (T/F)

3.  Classes are blueprints for objects. (T/F)
     
4. Both malloc and new return addresses. (T/F)

5. Objects combine both data and programs in one bundle. (T/F)

6. C++ requires the use of objects when writing application programs. (T/F)

7. One of the methods NOT normally used to send data from the CALLED function to the CALLING function in C is:
      a. global variable 
                b. pointer to variable in calling function
      c. instruction pointer register 
                d. return value of called function
      e. none of the above

8. A benefit of C++ is:
        a. reusable code via Inheritance.
        b. modularization via Encapsulation.
        c. abstraction thru the use of Templates. 
        d. all of the above. 
        e. none of these.

9. The constant "C" occupies how many bytes?
       a. 4  
                 b. 3 
                 c. 2  
                 d. 1  
                 e. none, it's stored on the Stack.
    
10. Many variables of the same Type, having the same Name,
grouped together and referenced via an integer value
constitute:

        a. a class.
        b. an array.
        c. a struct.
        d. a pointer.
        e. none of these.

11. Define: Pass by Reference:

        a. pass a copy of the variable's contents on the stack 
        b. pass the address of the variable on the stack 
        c. write a temp file to disk 
        d. write a temp buffer to working storage 
        e. none of the above

12. Define: Pass by Value

        a. pass a copy of the variable's contents on the stack 
        b. pass the address of the variable on the stack 
        c. write a temp file to disk 
        d. write a temp buffer to working storage 
        e. none of the above

13. Given: 
        float f , g ;
           .
           .
           .
        the better choice of the two comparisons below would be:

        a. if (f >= g) 
        b. if (f == g)

14. To copy the contents of int b[200]  to int a[200], you would:

        a. a = b ;
        b. memcpy(a, b, sizeof(a)) ;
        c. use a correctly written for() loop
        d. b or c above
        e. a, b, or c above

15. If you want to write a statement to read in the users name (first, (maybe
a middle) , last) from the keyboard, your usual method would be:

        a. cin >> namevar
        b. cin.get()
        c. cin.getline()
        d. each is as good as the others
        e. only a and b would work

16. Given: 

        int a[10][5] ; 

to access the second item in the 
3rd row, we would use:

a. a[2][3] ;    
b. a[3][2] ;    
c. *(*(a+3)+2) ; 
d. *(*(a+2)+1) ;        
e. none above

17. The Preprocessor reads in machine language programs that save us
repetitive coding. (T/F)
     
18. In C standard library I/O, the function used to disconnect a
FILE * pointer from the disk hardware after writing is:

a. fclose()     
b. close()      
c. unlink()     
d. chmod()      
e. none above
     
19. The ifstream and ofstream objects are both examples of
object creation by inheriting from the fstream object. (T/F).
     
20. sprintf() can translate between decimal,
Hexadecimal, and Octal. (T/F).
     
21  If the file path is inclosed in double quotes, the Preprocessor
looks in the absolute or relative path specified between the quotes. (T/F)

22. When searching a sorted array:

a. linear searching is more efficient
b. binary searching is more efficient
c. efficiency is a function of array type
d. binary is faster only if it is an array of floats
e. none of these are true
     
23. To do array processing, it is necessary to know
the size an array will be when you are writing the
program. (T/F).
     
24. To print the address of x given: int x, * pt; pt = &x ; you would
      a. printf("%X\n", pt) ; 
                b. printf("%X\n", &x) ; 
                c. printf("%X\n", *pt) ; 
                d. a & b above 
                e. none of the above

25. An array may never be initialized at compile time
      a. true b. false

26. Suppose an array has been defined as int arr[3]; , can you use the expression arr++ ?
      a. yes b. no

27. To allocate a two-dimensional array, a definition like: int arf[50,50] is used.
      a. true b. false

28. When you pass an array as an argument to a function, what is actually passed?
      a. the address of the array 
                b. the values of the elements in the array 
                c. a duplicate of the array 
                d. the number of elements in the array 
                e. none of the above

29. An assignment statement itself has a value, just like a variable.  (T/F)

30. In a simple if statement with no else, what happens if the condition is false?

        a. the program searches for the last else in the program 
        b. nothing 
        c. control "falls through" to the statement following the if construction 
        d. the body of the if statement is executed
     
31. The purpose of the " ? : " operator is to:

a. select the highest of the two values 
b. select the more equal of two values 
c. select one of two values alternately 
d. select one of two values depending on a condition    
e. none of the above
     
32. The statements following else in an if-else construction are executed when

        a. the conditional expression following if is false 
        b. the conditional expression following if is true
     
33. It is possible to print decimal-point-aligned 
financial data using cout using the sprintf() function. (T/F).
     
34. A non-static global variable may be altered 
by functions which are declared in any source file 
included in the project. (T/F)
     
35. A static global function may only be called by 
functions which are defined in the same 
source file. (T/F)
     
36. A static int variable is allocated only 
once in the run of the program, and keeps its 
value between calls of the function in which 
it is defined. (T/F)
     
37. C variables declared inside a function {} 
are visible only to the calling routine. (T/F)
     
38. Given: 
        main(int argc, char *argv[], char ** env) 
        
        argv[0] is local only to main, and may not be directly
        seen or used by any other function. (T/F)

39. static_cast<double>() is most similar to:

a. (double *)
b. (char *)
c. (int)
d. (double)
e. none of these
     
40.     Given: int a = 8 , b = 9 ;
        in order to get an accurate quotient, you must do:

        a.  cout << a / b ;
        b.  cout << (double) a / b ;
        c.  cout << (double) (a / b) ;
        d.  b or c above.
        e.  they all produce an accurate answer.

41. Encapsulation allows hiding how things work and only revealing
the controls. (T/F)

42. Abstraction means using a model that feels like the real thing
to manage complexity. (T/F)

43. Basic operators like '=' and '+' may never be overloaded. (T/F)

44. Each C++ program has a *.cpp file containing main(). (T/F)

45. The std::string::c_str() method returns a pointer the the string object. (T/F)

46. The signed char V  contains: 11111110  This number is negative. (T/F)

47. Vectors have the same usage as arrays, but they expand to the size you need.

48. The code:
   Charlie::scramble(x.begin(), x.end()) ; 
   futz.scramble(y.begin(), y.end()) ; 
            a) runs a member function, then a static function.  
                 b) runs a static function, then a member function.

49.  Objects may give birth to other Objects, either from solo
inheritance, or by multiple inheritance. (T/F)

50. Every C program must have one and only one function named MAIN() (T/F)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. B - correct
2. T - correct
3. T - correct
4. T - correct
5. F - incorrect
6. T - correct
7. A - Incorrect, It is C
8. D - correct
9. E - Incorrect, It is C
10. B - correct
11. B - correct
12. A - correct
13. A - correct
14. D - correct
15. C - correct
16. D - Incorrect, It is B
17. T - correct
18. C - Incorrect, It is A
19. T - correct
20. T - correct
21. T - correct
22. A - Incorrect, It is B
23. T - correct
24. D - Incorrect, It is C
25. B - correct
26. A - Incorrect, It is B
27. A - Incorrect, It is B
28. A - correct
29. T - correct
30. C - correct
31. D - correct
32. A - correct
33. T - correct
34. F - correct
35. T - correct
36. T - correct
37. T - correct
38. T - correct
39. D - correct
40. B - correct
41. T - correct
42. T - correct
43. F - correct
44. T - correct
45. T - correct
46. T - correct
47. T - correct
48. B - correct
49. F - correct
50. F - Incorrect, It is True

Add a comment
Know the answer?
Add Answer to:
These are my answere to the following questions: are they right? 1. B 2. T 3....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 17. Given the following definition of function £, what does the expression "t (1: 2: 3]::" return? let rec f listl match listl with 1 I head::rest -> head f resti b. 6 c. 120 d. 123 456...

    17. Given the following definition of function £, what does the expression "t (1: 2: 3]::" return? let rec f listl match listl with 1 I head::rest -> head f resti b. 6 c. 120 d. 123 456 e. g. 14; 5; 6] h. (6; 5; 4] i. Error message j. None of the above 18. Which of the following is the correct meaning of the C declaration "double (*a [n]) "? a is an array of n pointers to...

  • If void * is a pointer to void is a "generic" pointer type, and a void...

    If void * is a pointer to void is a "generic" pointer type, and a void * can be converted to any other pointer type * without an explicit cast, why in the ,myarrcopy function the malloc is created like char and not like void? if we are going to work with different type of arrays? Here is de program: *This is a function that make a copy of any given array. * We then use this function make a...

  • Update your first program to dynamically allocate the item ID and GPA arrays. The number of...

    Update your first program to dynamically allocate the item ID and GPA arrays. The number of items will be the first number in the updated “student2.txt” data file. A sample file is shown below: 3 1827356 3.75 9271837 2.93 3829174 3.14 Your program should read the first number in the file, then dynamically allocate the arrays, then read the data from the file and process it as before. You’ll need to define the array pointers in main and pass them...

  • 81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5...

    81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5 );                    int BoxVolume(int length = {1}, int width = {1}, int height = {1});                                                     T__   F__                                                                     82. The following function is implemented to swap in memory the          argument-values passed to it:         void swap(int a, int b)                   {           int temp;             temp = a;             a = b;             b = temp;        ...

  • what is the output for the following code? explain the steps. /*#include <iostream> using namespace std;...

    what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...

  • Variable Size Array with Classes, Testing. Study Code and Object Definition Windows of Microsoft ...

    Variable Size Array with Classes, Testing. Study Code and Object Definition Windows of Microsoft Visual Studio described here. As you work on the below project, demonstrate to the instructor the usage of this feature. Create a project titled Lab11_VarArrayTest. Implement the dynamically expanding and contracting array of doubles described in the previous lab as a class. You should use this class definition. The class attributes are a pointer to the dynamically allocated array dAarray and the array size size This...

  • I'm not getting out put what should I do I have 3 text files which is...

    I'm not getting out put what should I do I have 3 text files which is in same folder with main program. I have attached program with it too. please help me with this. ------------------------------------------------------------------------------------ This program will read a group of positive numbers from three files ( not all necessarily the same size), and then calculate the average and median values for each file. Each file should have at least 10 scores. The program will then print all the...

  • B. Which statement would be used to define a to element integer array c? a. Array...

    B. Which statement would be used to define a to element integer array c? a. Array c = int[10]; b. C = int[10]; c. int Array c[10]; d. int c[10]; 17. Declare an Integer pointer variable named int_ptr. 18. Use the pointer created in question 17 and assign it the memory location of a variable named int_var. 19. Suppose you have an executable program named count that counts the characters in its input. Devise a command-line command using the count...

  • WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL...

    WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL PASTE AT BOTTOM MOVIES.CPP #include "movies.h" #include "Movie.h" Movies *Movies::createMovies(int max) { //dynamically create a new Movies structure Movies *myMovies = new Movies; myMovies->maxMovies = max; myMovies->numMovies = 0; //dynamically create the array that will hold the movies myMovies->moviesArray = new Movie *[max]; return myMovies; } void Movies::resizeMovieArray() { int max = maxMovies * 2; //increase size by 2 //make an array that is...

  • problem 2 and 3 1. For each variable (a-g) describe whether the variable itself is global...

    problem 2 and 3 1. For each variable (a-g) describe whether the variable itself is global or local, static or not static, and initialized or uninitialized. (Hints: Global variables are always static. Local variables become static when declared with 'static'. For pointers, consider the pointer itself, not anything the pointer might point to.) 2. For each variable (a-g), describe where it is located when DoFunctionB is running. That is, for each variable, describe whether it is on the stack, in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT