# C+ Programming Toughest Exam! Quiz

30 Questions | Total Attempts: 123

Settings

.

• 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.

• 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.

• 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.

• 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!

• 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.

• 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

• 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

• 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

• 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.

• 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.

• 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.

• 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.

• 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.

• 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.

• 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.

• 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.

• 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.

• 18.
What will this code produce when run?
• A.

B = 5

• B.

B = 4

• C.

None of these options are correct.

• 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.

• 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.

• 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.

• 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.

• 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.

• 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

• 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.

Related Topics