Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Questions Part 2 Explain why it\'s false for all the false answers. 7) TRUE/

ID: 3696706 • Letter: C

Question

C++ Questions Part 2

Explain why it's false for all the false answers.

7) TRUE/ FALSE The operators have already been overloaded by the stream classes! TRUE/ FALSE Originally they were used to multiply and divide integer types by 8) Name at least three operators which cannot be overloaded. (Reminder: there were 5-or 6 depending on how you count that one-operators that are not overload-able.) 9) TRUE/ FALSE A type must be programmer-defined for operators to be overloaded for it TRUE/ FALSE This at least includes classes and enumerations. 10) Explain the general use of the seekg and tellg methods in stream processing. 11) When is the eof flag raised (seton) in an input stream object? (There is only one condition that causes this...) What about the fail flag? When is it raised (set/on) in an input stream object? (There are at least three-3 conditions that can cause this...) 12) Stream formatting methods can be used by including the library in your pro- gram. The formatting manipulators, however, require inclusion of the library header. 13) TRUE/FALSE If you forget to close a file stream, nothing could possibly go wrong. 14) You are given a class Class which has the array member arr (which is of base type bool) whose used entries are counted by member count (which is of type sizet). Show (pseudojcode for operator] to bre used to access the elements of arr from a Class object. (Hint: How many operator functions does it take to

Explanation / Answer

TRUE

/ EXAMPLE Using the shift operators to multiply and divide

public class MultDiv {

public static void Main() {

int n;

n = 10;

Console.WriteLine("Value of n: " + n);

// multiply by 2

n = n << 1;

Console.WriteLine("Value of n after n = n * 2: " + n);

// multiply by 4

n = n << 2;

Console.WriteLine("Value of n after n = n * 4: " + n);

// divide by 2

n = n >> 1;

Console.WriteLine("Value of n after n = n / 2: " + n);

// divide by 4

n = n >> 2;

Console.WriteLine("Value of n after n = n / 4: " + n);

Console.WriteLine();

// reset n

n = 10;

Console.WriteLine("Value of n: " + n);

// multiply by 2, 30 times

n = n << 30; // data is lost

Console.WriteLine("Value of n after left-shifting 30 places: " + n);

}

}

8) The following operators cannot be overloaded   

1. (.) (Member Access or Dot operator)
2. ?: (Ternary or Conditional Operator )
3. :: (Scope Resolution Operator)
4. .* (Pointer-to-member Operator )
5. sizeof (Object size Operator)
6. typeid (Object type Operator)

9) True   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote