How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Raj Your Own Question

Raj
Raj, Engineer
Category: Homework
Satisfied Customers: 1282
Experience:  4 + Experiance in IT Industry
16752232
Type Your Homework Question Here...
Raj is online now
A new question is answered every 9 seconds

1. (TCO 4) What is the bit pattern in data after the following

Customer Question

1. (TCO 4) What is the bit pattern in data after the following statements execute?
unsigned int data = 10;
data = data | 0x0B;
data = data << 1; (Points : 7)
0x314
0x154
0x342
0x156


2. (TCO 4) What is the value of data after the following code executes?
unsigned char data = 0xA5;
data = data & 0xF0; (Points : 7)
0xA0
0xF0
0xF5
0x5A


3. (TCO 4) What is wrong with the following switch statement?
switch(x)
{
case 0:
cout << x;
case 2:
cout << 2 / x;
break;
default:
cout << “error”;
break;
} (Points : 7)
The value of x could be something other than 1 or 2.
There is no break statement for case 1.
There is no semicolon after the closing bracket.
All of the above


4. (TCO 4) A variable declared before and outside all function blocks (Points : 7)
is visible only in main.
is visible to all functions.
is visible to all functions except main.
is not visible to any functions.


5. (TCO 4) C++ selection statements include
(Points : 7)
for, while, do-while.
cout and cin.
if, if-else, if-else if, switch.
#include and using namespace std;.


6. (TCO 4) Which operation in the following expression will be performed first?
c = a++ / b + 5; (Points : 7)
a
a/b
assignment to c
b + 5


7. (TCO 4) How many elements does the following array contain?
double data [100] [500]; (Points : 7)
500
100
600
50,000


8. (TCO 4) The code below computes the length of a C-style string. What should the value of FLAG be?
char name[20]= "Lancilot";
int length=0;
while(name[length] != FLAG)
{
length = length+1;
}
cout << length << endl; (Points : 7)
‘\0’
20
NULL
0


9. (TCO 4) Given the following code to fill an array,
int;
int data[100];
for(int i = 0; i <= X; i++)
data = i;
what should the value of X be? (Points : 7)
100
101
99
i


10. (TCO 4) Given the following code fragment, what is the data type of thisStudent?
struct student
{
string name;
double gpa;
};
student thisStudent; (Points : 7)
string
const pointer to student
student
double


11. (TCO 4) Which of the following is an invalid declaration to overload the following function?
double foo(int); (Points : 7)
double foo(double);
int foo(int);
double foo(double *):
double foo(int *);


12. (TCO 4) Which of the following statements call the following function correctly?
int MultiplyValues (int, int); (Points : 7)
int a = MultiplyValues (int x, int y);
int a = MultiplyValues (10, 20);
double d = MultiplyValues (int 10, int 20);
All of the above


13. (TCO 4) What is the output of the following code?
void func(int x[ ])
{
x[0] = x[0] * 3;
x[1[ = x[1] * 3;
x[2] = x[2] * 3;
}
void main ()
{
int x[ ] = {1, 2, 3};
func(x);
cout << x[0] << “ “ << x[1] << “ “ << x[2] << endl;
} (Points : 7)
1 2 3
3 4 5
3 6 9
3 3 3


14. (TCO 4) Which of the following function definitions uses pass-by-values? (Points : 7)
int myFunc( int * x, int * y );
int myFunc( int x, int y ) ;
int myFunc( int & x, int & y ) ;
int myFunc( int @ value1, int @ value2 ) ;


15. (TCO 4) Which of the following is called automatically each time an object is created? (Points : 7)
Compiler
Builder
Constructor
Destructor


16. (TCO 4) Creating one class from another in a parent/child hierarchy is an example of (Points : 7)
encapsulation.
polymorphism.
inheritance.
abstraction.


17. (TCO 4) A Distance class has two private members, ‘feet’, of type int, and ‘inches’, of type double. Which prototype correctly declares the copy constructor for such class? (Points : 7)
Distance Distance(const Distance &);
Distance(const Distance &);
int Distance(int, double);
Distance(feet, inches);


18. (TCO 4) Composition is typically an example of (Points : 7)
a “has a” relationship.
an “is a” relationship.
a “uses a” relationship.
a “is used” relationship.


19. (TCO 4) What is the name of a member function of a class that only accesses the value(s) of member variable(s) and does not modify the value(s)? (Points : 7)
Set
Private
Member
Accessor


20. (TCO 4) A derived class is typically an example of (Points : 7)
a “has a” relationship.
an “is a” relationship.
a “uses a” relationship.
a “is used” relationship.


21. (TCO 4) When writing a class, the compiler automatically creates some support functions for the class. What are some of these functions? (Points : 7)
Assignment operator function
Copy constructor
Submitted: 3 years ago.
Category: Homework
Expert:  Raj replied 3 years ago.
Hi there,

How much time is left for the questions to be answered.
And can you please post all the question once again?

Thank you
Customer: replied 3 years ago.

I have an hour left;


1. (TCO 4) What is the bit pattern in data after the following statements execute?
unsigned int data = 10;
data = data | 0x0B;
data = data << 1; (Points : 7)
0x314
0x154
0x342
0x156


2. (TCO 4) What is the value of data after the following code executes?
unsigned char data = 0xA5;
data = data & 0xF0; (Points : 7)
0xA0
0xF0
0xF5
0x5A


3. (TCO 4) What is wrong with the following switch statement?
switch(x)
{
case 0:
cout << x;
case 2:
cout << 2 / x;
break;
default:
cout << “error”;
break;
} (Points : 7)
The value of x could be something other than 1 or 2.
There is no break statement for case 1.
There is no semicolon after the closing bracket.
All of the above


4. (TCO 4) A variable declared before and outside all function blocks (Points : 7)
is visible only in main.
is visible to all functions.
is visible to all functions except main.
is not visible to any functions.


5. (TCO 4) C++ selection statements include
(Points : 7)
for, while, do-while.
cout and cin.
if, if-else, if-else if, switch.
#include and using namespace std;.


6. (TCO 4) Which operation in the following expression will be performed first?
c = a++ / b + 5; (Points : 7)
a
a/b
assignment to c
b + 5


7. (TCO 4) How many elements does the following array contain?
double data [100] [500]; (Points : 7)
500
100
600
50,000


8. (TCO 4) The code below computes the length of a C-style string. What should the value of FLAG be?
char name[20]= "Lancilot";
int length=0;
while(name[length] != FLAG)
{
length = length+1;
}
cout << length << endl; (Points : 7)
‘\0’
20
NULL
0


9. (TCO 4) Given the following code to fill an array,
int;
int data[100];
for(int i = 0; i <= X; i++)
data = i;
what should the value of X be? (Points : 7)
100
101
99
i


10. (TCO 4) Given the following code fragment, what is the data type of thisStudent?
struct student
{
string name;
double gpa;
};
student thisStudent; (Points : 7)
string
const pointer to student
student
double


11. (TCO 4) Which of the following is an invalid declaration to overload the following function?
double foo(int); (Points : 7)
double foo(double);
int foo(int);
double foo(double *):
double foo(int *);


12. (TCO 4) Which of the following statements call the following function correctly?
int MultiplyValues (int, int); (Points : 7)
int a = MultiplyValues (int x, int y);
int a = MultiplyValues (10, 20);
double d = MultiplyValues (int 10, int 20);
All of the above


13. (TCO 4) What is the output of the following code?
void func(int x[ ])
{
x[0] = x[0] * 3;
x[1[ = x[1] * 3;
x[2] = x[2] * 3;
}
void main ()
{
int x[ ] = {1, 2, 3};
func(x);
cout << x[0] << “ “ << x[1] << “ “ << x[2] << endl;
} (Points : 7)
1 2 3
3 4 5
3 6 9
3 3 3


14. (TCO 4) Which of the following function definitions uses pass-by-values? (Points : 7)
int myFunc( int * x, int * y );
int myFunc( int x, int y ) ;
int myFunc( int & x, int & y ) ;
int myFunc( int @ value1, int @ value2 ) ;


15. (TCO 4) Which of the following is called automatically each time an object is created? (Points : 7)
Compiler
Builder
Constructor
Destructor


16. (TCO 4) Creating one class from another in a parent/child hierarchy is an example of (Points : 7)
encapsulation.
polymorphism.
inheritance.
abstraction.


17. (TCO 4) A Distance class has two private members, ‘feet’, of type int, and ‘inches’, of type double. Which prototype correctly declares the copy constructor for such class? (Points : 7)
Distance Distance(const Distance &);
Distance(const Distance &);
int Distance(int, double);
Distance(feet, inches);


18. (TCO 4) Composition is typically an example of (Points : 7)
a “has a” relationship.
an “is a” relationship.
a “uses a” relationship.
a “is used” relationship.


19. (TCO 4) What is the name of a member function of a class that only accesses the value(s) of member variable(s) and does not modify the value(s)? (Points : 7)
Set
Private
Member
Accessor


20. (TCO 4) A derived class is typically an example of (Points : 7)
a “has a” relationship.
an “is a” relationship.
a “uses a” relationship.
a “is used” relationship.


21. (TCO 4) When writing a class, the compiler automatically creates some support functions for the class. What are some of these functions? (Points : 7)
Assignment operator function
Copy constructo


Assignment operator and copy constructor


None of the above


 


22. (TCO 4) Given the definition of
some class called Employee, which of the following correctly dynamically
allocates an array of 20 Employee objects?


Employee * myData = new Employee[20];


Employee myData[20] = new Employee[20];


Employee = myData[20];


Employee array = new Employee[20];


 


23. What is the output of the following code snippet?
int value = 10;
int *
iptr = &value;
*iptr = 5;
Cout << *iptr << “ “ <<
value;


5 5


10 10


5 10


10 5


 


24. What is the output of the following code snippet?
int *p;
int *q;
p =
new int;
*p = 43;
q = p;
*q = 52;
p = new int;
*p = 78;
q =
new int;
*q = *p;
cout << *p << " " << *q << end1


 


4352


5278


7878


7852

Expert:  Raj replied 3 years ago.
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.
Expert:  Raj replied 3 years ago.
THIS ANSWER IS LOCKED!
You can view this answer by clicking here to Register or Login and paying $3.
If you've already paid for this answer, simply Login.