Monday , June 17 2024
Breaking News

CPA – Programming Essentials in C++ Module 1 Exam Answers

CPA – Programming Essentials in C++ Module 1 Exam Answers

Question 1: What is the output of the following snippet if a digit 8 followed by Enter is entered through the keyboard?

#include <iostream>

using namespace std;

int main()

{

    int i;

    cin >> i;

    cout << i << hex << i + i << oct << i;

}

  • 8×10010
  • 81010
  • 8168
  • 810010

Question 2: Which of the following strings is a proper floating-point number (in the C++ language sense)?

  • 3,14
  • E14
  • 3.14
  • 3_14

Question 3: What is the output of the following snippet if a digit 5 followed by Enter is entered through the keyboard?

#include <iostream>

using namespace std;

int main()

{

    int i = 3, j = ++i, k = ++i;

    cin >> i;

    cout << k + i << j – i << i * i;

}

  • 10125
  • 10-125
  • 10-545
  • 10545

Question 4: What is the value of the following literal? OE1

  • 0
  • 0.01
  • 0.1
  • The literal is invalid.

Question 5: What is the output of the following snippet?

#include <iostream>

using namespace std;

int main()

{

    int i = 3, j = ++i, k = ++i;

    cout << k << j << i;

  • 545
  • 543
  • 454
  • 345

Question 6: What is the value of the following literal? 0X1A

  • 6
  • The literal is invalid.
  • 26
  • 16

Question 7: Which of the following strings is a correct integer number (in the C++ language sense)?

  • 3E14
  • 3.14
  • 3’14
  • 3,14

Question 8: What is the final value of the k variable?

int i = 3, j = 2, k = -1;

if(i > 0) {

    if(j <= 0) {

        if(k < 0)

            k++;

        if(k <= 0)

            k–;

    }

    if(j > 0)

        i++;

}

if(i <= 0)

    j++;

k = i + j + k;

  • 3
  • 6
  • 5
  • 4

Question 9: What is the value of the following literal?

018

  • 2
  • 16
  • 10
  • The literal is invalid.

Question 10: What is the value of the following literal?

-1e-1

  • The literal is invalid.
  • -0.1
  • -1.0
  • -10.0

Question 11: What is the value of the following literal?

X10

  • 10
  • 2
  • The literal is invalid.
  • 16

Question 12: Which of the following strings does not represent a valid variable name?

  • auto
  • AUTO
  • Auto
  • aUTO

Question 13: What is the value of the x variable?

float x = 1. / 2. + 2. / 4.;

  • 0.75
  • 0.5
  • 0.25
  • 1.0

Question 14: What is the value of the k variable?

int k = 1 % 2 + 4 % 2;

  • 1
  • 0
  • 2
  • 3

Question 15: What is the value of the k variable?

int i = 1;

int j = ++i;

int k = j++;

  • 0
  • 3
  • 2
  • 1

Question 16: Which of the following strings represents a legal variable name?

  • #1_literal_is_invalid
  • 1st_literal_is_invalid
  • first_literal_is_invalid
  • first literal is invalid

Question 17: What is the output of the following snippet if a string 2.5 followed by Enter is entered through the keyboard?

#include <iostream>

using namespace std;

int main()

{

    float x;

    cin >> x;

    cout << scientific << “x”;

}

  • 2.5E0
  • x
  • 2.5
  • 0.25E1

Question 18: What is the value of the following literal?

010

  • 2
  • The literal is invalid.
  • 10
  • 8

Question 19: What is the value of the i variable?

float x = 1.0 / 4.0;

int=x;

  • 0.33
  • 0
  • 0.25
  • 1

Question 20: What is the final value of the k variable?

int i = 3, j, k;

if(i > 0) j = 2 + i * i;

if(i <= 0) j = 2 * i – 1;

if(j >= 0) k = j % i + 2;

if(j < 0) k = i % j + 2;

if(k < 0) k = k % i % j;

if(k >=0) k = j % i % k;

  • 3
  • 1
  • 0
  • 2

About Clear My Certification

Check Also

Contact Us

[contact-form-7 id=”dd026da” title=”Contact form 1″]

Leave a Reply

Your email address will not be published. Required fields are marked *