ECET 299 Quiz

Lab Price = $20
[orb_cyber_store id=”271″]
Please feel free to send us your queries at: support@iqrajavaid.com
Problem Statement
1. (TCO 4) What is the value stored in variable c, after the execution of the following statement?
int a=5, b=2, c;
c = ++a / b + 5; (Points : 7)
7.5
8
7
0

2. (TCO 4) Which of the following is not a C++ logical operator? (Points : 7)
#
&&
││
!

3. (TCO 4) Which of the following expressions is correct if you want to end a while-loop when the character variable keepgoing is anything other than character y in either upper or lowercase?(Points : 7)
while (keepgoing == “y” ││ keepgoing == “Y”)
while (keepgoing == ‘y’ && keepgoing == ‘Y’)
while (keepgoing == “y” ││ keepgoing == “Y”)
while (keepgoing == ‘y’ ││ keepgoing == ‘Y’)

4. (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

5. (TCO 4) What is the value of i after the following code fragment executes?
int i = 2;
int k = 5 ;
i *= k + 1; (Points : 7)
7
11
12
14

6. (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.

7. (TCO 4) What is the declaration for a C-style string that can hold a name with up to 3 printable characters (for example, “Ron”)? (Points : 7)
int name [3];
char name [3]
int name [4];
char name [4];

8. (TCO 4) What is the data type of bullpen[3].era?
struct pitcher
{
string name;
double era;
};
pitcher p1;
pitcher bullpen[10]; (Points : 7)
string
double
pitcher
const pointer to pitcher

9. (TCO 4) The following code fragment
struct student
{
string name;
double gpa;
};
student thisStudent;
cout << “Enter this student’s name: “ << flush; cin >> thisStudent.name;
cout << “Enter this student’s GPA: “ << flush; cin >> thisStudent.gpa;
student nextStudent = thisStudent; (Points : 7)
copies both thisStudent’s name and gpa to nextStudent.
displays the name and gpa of thisStudent.
causes a compiler error.
causes a run-time error.

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

11. (TCO 4) Identify the correct prototype for a function that receives an array of doubles, finds the position of the largest value in the array, and returns the position to the calling function. (Points : 7)
void findPosition(double array[], int size, double * position);
void findPosition (double array[], int size, int * position);
double findPosition (double array[], int size);
All of the above

12. (TCO 4) When a variable is passed by reference (Points : 7)
the variable can be changed by the calling and the called function.
the parameter name is an alias of the variable passed.
the called function can change the value of the variable in the calling program.
All of the above

13. (TCO 4) Identify the correct prototype for a function that receives an array of doubles, computes the sum of all the elements of the array, and returns the sum to the calling function. (Points : 7)
void computeSum(double array[], int size, double * sum);
void computeSum(double array[], int size, double & sum);
double computeSum(double array[], int size);
All of the above

14. (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 *);

15. (TCO 4) Variables defined to be of a user-declared class are referred to as (Points : 7)
attributes.
member variables.
primitive variables.
objects.

16. (TCO 4) Which of the following is a valid declaration to overload the following function?
int whatever (double x); (Points : 7)
double whatever (double x);
int whatever (int x);
int whatever2 (double x);
int overload (double x);

17. (TCO 4) A Distance class has two private members, ‘feet’, of type int, and ‘inches’, of type double. Which prototype correctly declares a 2-argument constructor for such class? (Points : 7)
Distance(int, double);
void Distance(int, double);
int Distance(int, double);
Distance(feet, inches);

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

19. (TCO 4) Creating classes with private data members is an example of (Points : 7)
encapsulation.
polymorphism.
inheritance.
abstraction.

20. (TCO 4) When organizing a program into three files (main, class implementation, and class header), which is not a .cpp file? (Points : 7)
Main
None are .cpp
Class header
Class implementation

21. (TCO 4) Given the following definitions, select the statement that is illegal?
int * iptr;
double * dptr;
int j = 10;
double d = 10.0; (Points : 7)
iptr = &j;
dptr = &d;
iptr = 0;
dptr = &j;

22. (TCO 4) Assume you have to write a class that makes use of dynamic memory allocation (the class needs to allocate and de-allocate memory). According to best practices, where would the keyword ‘delete’ be placed? (Points : 7)
Classes are smart data types. The compiler takes care of calling new/delete
It is in the constructor.
It is in the destructor.
It is in a separate, dedicated function.

23. (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
Assignment operator and copy constructor
None of the above

24. (TCO 4) Given a class called Employee and the following definitions and statements,
void myFunction (Employee * eptr);
Employee emp;
which of the following statements correctly calls the function passing in the address of the data array? (Points : 7)
myFunction(emp);
myFunction(&emp);
myFunction(*emp);
myFunction(**emp);

25. (TCO 4) Which of the following is not a legal value to initialize a pointer variable? (Points : 7)
Zero
Null
0
The address of a variable of the same type

Instructions
* Please click on “Buy Now” button to complete the purchase.Please note that the payment is done through PayPal.
* If you have any issues with the payment method, please let us know at support@iqrajavaid.com and that can be discussed and considered.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at support@iqrajavaid.com.
* As soon as the payment is received through PayPal, download link of the solution will automatically be sent to the address used in Paypal.
* Please check your junk mails as the download link email might go there.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at support@iqrajavaid.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please expect to get a response within 8 hours from our side.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at support@iqrajavaid.com.

******************************************** Good Luck ***************************************************

Payment Details
Lab Price = $20
[orb_cyber_store id=”271″]
Please feel free to send us your queries at: support@iqrajavaid.com

Leave a Reply