C+ Programming Toughest Exam! Quiz

30 Questions | Attempts: 127
Share

SettingsSettingsSettings
C+ Programming Toughest Exam! Quiz - Quiz

.


Questions and Answers
  • 1. 

    Examine this C/C++ code. What is a suitable variable declaration for the variable "a"?

    • A.

      Int a;

    • B.

      Float a;

    • C.

      Double a;

    • D.

      None of these options are correct.

    Correct Answer
    A. Int a;
  • 2. 

    Examine this code. Which option below do you think best describes this code?

    • A.

      There is an error in this code.

    • B.

      The integer a is declared and defined as 5.

    • C.

      The decimal variable a is declared and defined.

    • D.

      The variable a is declared, but not defined.

    Correct Answer
    B. The integer a is declared and defined as 5.
  • 3. 

    Examine this code. Which of the following choices is correct?

    • A.

      There is a mistake in this code.

    • B.

      Both variables a and b are declared as integers.

    • C.

      Both variables a and b are declared and defined.

    • D.

      The integer b is defined and declared, while the integer a is only defined.

    Correct Answer
    D. The integer b is defined and declared, while the integer a is only defined.
  • 4. 

    Read this code - what can you say about the variables a and b?

    • A.

      The floating point variable a cannot be defined as an integer 5.

    • B.

      The variables a and b are both declared and defined.

    • C.

      The variables a and b are only declared.

    • D.

      This is a mistake in this code - it will not work!

    Correct Answer
    B. The variables a and b are both declared and defined.
  • 5. 

    Consider this code and choose the best option below.

    • A.

      This code is incorrect and will not work.

    • B.

      This code MAY be incorrect - there is not enough information.

    • C.

      The variables c and d are declared.

    • D.

      The variables c and d are declared and defined.

    Correct Answer
    B. This code MAY be incorrect - there is not enough information.
  • 6. 

    Read this code and choose the correct option below. When this code is run, what will be shown?

    • A.

      This code will not run - there is an error in the code.

    • B.

      A = %d\n

    • C.

      A = 5

    • D.

      A = 5\n

    Correct Answer
    A. This code will not run - there is an error in the code.
  • 7. 

    Consider this code - what will the value of c be?

    • A.

      This code is not correct, and will not run.

    • B.

      C = 5

    • C.

      C = false

    • D.

      C = 0

    Correct Answer
    D. C = 0
  • 8. 

    Consider this code as shown. When it is run, what will it show?

    • A.

      This code will not run - there is an error.

    • B.

      C = 5

    • C.

      C = 2

    • D.

      C = 3

    Correct Answer
    D. C = 3
  • 9. 

    Consider the following code. What will it produce when it is run?

    • A.

      The code is not correct, and will not run.

    • B.

      C = 1

    • C.

      C = 0

    • D.

      None of these answers are correct.

    Correct Answer
    B. C = 1
  • 10. 

    Consider the code shown - when it is run, what will it show?

    • A.

      A = 0000023FD74, b = 5

    • B.

      a = 5, b = 5

    • C.

      The code will not run - there is an error.

    • D.

      A = 0, b = 5.

    Correct Answer
    A. A = 0000023FD74, b = 5
  • 11. 

    What will this code produce when run?

    • A.

      A = 5

    • B.

      A = 00007542DCE1

    • C.

      This code won't run - there is an error.

    • D.

      None of these options are correct. The code will produce something else.

    Correct Answer
    A. A = 5
  • 12. 

    What will this code produce when run?

    • A.

      A = 5

    • B.

      A = 0000743DEF2

    • C.

      This code will not work - there is an error.

    • D.

      None of these - the code will produce something else.

    Correct Answer
    A. A = 5
  • 13. 

    What will this code produce when run?

    • A.

      A = 5

    • B.

      A = 00000742DEF0

    • C.

      This code won't run - there is an error.

    • D.

      None of these options - this code will produce something else.

    Correct Answer
    B. A = 00000742DEF0
  • 14. 

    What will this code produce when it is run?

    • A.

      There is an error in this code, and it will not run.

    • B.

      Result = 1 and 3

    • C.

      Result = 2 and 4

    • D.

      None of these answers.

    Correct Answer
    C. Result = 2 and 4
  • 15. 

    What will this code produce when run?

    • A.

      This code won't run - there is an error.

    • B.

      Result = 1 and 3

    • C.

      Result = 2 and 4

    • D.

      This code will run - but the array b is not defined. It will produce rubbish.

    Correct Answer
    B. Result = 1 and 3
  • 16. 

    What will this code produce when run?

    • A.

      Not Equal

    • B.

      Equal

    • C.

      This code won't run - there is an error.

    • D.

      None of these options are correct.

    Correct Answer
    A. Not Equal
  • 17. 

    Examine this code - what will it produce when it is run?

    • A.

      Equal

    • B.

      Not equal

    • C.

      This code won't run - there is an error!

    • D.

      None of these options are correct.

    Correct Answer
    B. Not equal
  • 18. 

    What will this code produce when run?

    • A.

      B = 5

    • B.

      B = 4

    • C.

      None of these options are correct.

    • D.

      B = 2

    Correct Answer
    D. B = 2
  • 19. 

    What will this code produce when compiled and run?

    • A.

      There is an error in this code, and it will not run.

    • B.

      Sum = 0

    • C.

      Sum = 7

    • D.

      There is not enough information to answer this question.

    Correct Answer
    C. Sum = 7
  • 20. 

    What will this code produce when compiled and run?

    • A.

      Result = 5, 7

    • B.

      Result = 5, 2

    • C.

      There is an error in this code, and it will not run.

    • D.

      None of these options are correct.

    Correct Answer
    A. Result = 5, 7
  • 21. 

    Examine this code. Is there an error in this code, and if so, which line is it on?

    • A.

      Line 4 (The line with the for loop)

    • B.

      Line 1 (The line with the #include)

    • C.

      Line 7 (The line with the printf)

    • D.

      There are no errors in this code.

    Correct Answer
    A. Line 4 (The line with the for loop)
  • 22. 

    Consider this MATLAB code. What do you think this code does?

    • A.

      Uses the Bisection method to solve the equation erf(x) = x - 2

    • B.

      Uses the Newton Raphson method to solve the equation erf(x) = x - 2

    • C.

      This code will not run, as there is an error in it.

    • D.

      This code does not use either the Bisection Method or Newton-Raphson method.

    Correct Answer
    A. Uses the Bisection method to solve the equation erf(x) = x - 2
  • 23. 

    Consider the Bisection method code as shown. What will the final value of e be when the code is run?

    • A.

      E = 3.59375

    • B.

      E = 3.741657

    • C.

      E = 3.4375

    • D.

      This code will not run - there is a mistake in the code.

    Correct Answer
    A. E = 3.59375
  • 24. 

    Consider the Bisection method code shown. What will the final value of e be when the computation is completed?

    • A.

      There is a mistake in this code, and it will not run.

    • B.

      E = 3.7416

    • C.

      E = 4.8537

    • D.

      E = 3.59375

    Correct Answer
    C. E = 4.8537
  • 25. 

    If (dy/dt) = 5y and y = 2 when t = 0, compute y at t = 0.6 using the Euler method. Use a timestep dt of 0.2. (i.e. dt = 0.2). 

    • A.

      Y(0.6) ~ 16

    • B.

      Y(0.6) ~ 10

    • C.

      Y(0.6) ~ 40

    • D.

      None of these options are correct.

    Correct Answer
    A. Y(0.6) ~ 16
  • 26. 

    Consider the attached Euler method code used to solve an ODE.After looking at this code - what do you think the ODE being solved is?

    • A.

      This code won't work - the output variable u is not defined, so the code won't run.

    • B.

      (See this equation)

    • C.

      (See this equation)

    • D.

      None of these options are correct.

    Correct Answer
    D. None of these options are correct.
  • 27. 

    Consider this Colobot code designed to shoot at an enemy. What problem does this method have?

    • A.

      The code is fine - this robot will hit its target if the enemy is less than 5 units away.

    • B.

      The code won't work - there is an error in the code (i.e. it won't compile or run)

    • C.

      The robot won't hit a moving target, even if it is range, because the target data is old.

    • D.

      The robot doesn't change the angle of the gun - if the target is too low or too high, it won't hit it.

    Correct Answer
    D. The robot doesn't change the angle of the gun - if the target is too low or too high, it won't hit it.
  • 28. 

    Consider the radar data and colobot code shown here. The position of your robot is shown by the red dot, while other item positions are shown by blue dots.After this code is run, what might the array "a" contain?

    • A.

      A = [7.07, 11.18, 25, 31.622, 0]

    • B.

      A = [5, 10, 25, 30, 0]

    • C.

      A = [31.622, 0, 0, 0, 0]

    • D.

      None of these options are correct.

    Correct Answer
    A. A = [7.07, 11.18, 25, 31.622, 0]
  • 29. 

    Examine this Colobot code. What will this robot do when an enemy approaches?

    • A.

      It will change direction to run away (backwards) from the enemy when it is close enough.

    • B.

      This robot will do nothing - it will sit still until it dies.

    • C.

      The robot will not change its direction, but will try to run away from the enemy.

    • D.

      The robot will try to run into the enemy robot.

    Correct Answer
    A. It will change direction to run away (backwards) from the enemy when it is close enough.
  • 30. 

    Using the Trapezoid Rule, find the integral of x*sin(x) from x = 0 to 1 using 5 parts. What is the approximate answer using the Trapezoid Rule?

    • A.

      None of these answers are correct.

    • B.

      0.301

    • C.

      0.389

    • D.

      0.221

    Correct Answer
    B. 0.301

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 17, 2022
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 14, 2016
    Quiz Created by
    Archembaud
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.