Zookal
Zookal

We’d love to hear any feedback or comment from you!

© 2011-2021 Zookal Pty Ltd

View question and answer

From our collection of questions and answers
Engineering · Computer Science
Question details

1) What is the output of the following code?

int main() {

   int x = 53; int y = 0;

   if( x > 31 ) {

       y = 30;

   }

   else {

       y = 10;

   }

   cout << y;

   return 0;

}

Select one:

a. 30

b. 53

c. 10

d. 0

5) What is the clock in a computer?

Select one:

a. The doubling of IC capacity roughly every 18 months.

b. The frequency a processor executes instructions.

c. Manages programs and interfaces with peripherals.

d. Relatively-small volatile storage with fastest access located in processor chip.

15) What is the output of the following code?

int main() {

   string cityName = “La Jolla”;

   cityName.push_back(‘!’);

   cout << cityName;

   return 0;

}

Select one:

a. La Joll!

b. !!!!!!!!

c. !La Jolla

d. La Jolla!

16) Which line of code causes an error?

int main() {

   const int N = 5;

   vector<int> nums(N, 6); // A)

   int i = 0;

   nums.at(0) = -1; // B)

   cout << nums[0] << endl; // C)    

   return 0;

}

Select one:

a. vector<int> nums(N, 6);

b. nums.at(0) = -1;

c. cout << nums[0] << endl;

d. None of the above.

18) What is the output of the following code?

int main() {

   double y = 7 / 2;

   cout << y;

   return 0;

}

Select one:

a. 0

b. 3

c. 3.5

d. No output. Error in code.

24) Which statement results in x having a maximum value of 200?

Select one:

a. x = (x > 200) ? x : 200;

b. x = (x > 200) ? 200 : x;

c. x = (x < 200) ? x : 300;

d. x = (x < 200) ? 200 : x;

25) How many times will the output statement execute in the following code?

int main() {

   int i = 0; int j = 0;

   for(i = 1; i <= 3; ++i) {

       for(j = 1; j <= 5; ++j) {

           cout << i << j << " ";

       }

   }

   return 0;

}

Select one:

a. 3

b. 8

c. 15

d. 24

33) What is the output of the following code?

int main() {

   int x = 0; int y = 2;

   while (x == 10) {

       cout << x << " ";

       x = x * y;

   }

   return 0;

}

Select one:

a. 0 2 4 6 8 10

b. 2 4 6 8 10

c. Loop is never entered. No output.

d. Infinite loop causes infinite output.

38) Which of the following defines an array named nums with 3 elements each initialized to 5?

Select one:

a. int nums[5] = {3, 3, 3};

b. int nums[3] = (3,5);

c. int nums[3] = {5, 5, 5};

d. int nums{5, 5, 5};

40) What is the value assigned to variable z for the following code, assuming the initial values of a = 2, b = 2, and c = 50?

mult = 0;

while (a < 20) {

   mult = b * a;

   if (mult > c) break;

   a = a + 1;

}

z = a;

Select one:

a. 10

b. 20

c. 50

d. 100

Answer
Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.

Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.