0% found this document useful (0 votes)
906 views7 pages

Incorrect: The Following String

This document contains 10 multiple choice questions about C++ programming concepts such as variable naming, functions, data types, operators, and input/output. Each question has one correct answer choice and three incorrect choices. The questions cover topics like variable scope and value, arithmetic and logical operators, function definitions, input parsing, and mathematical operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
906 views7 pages

Incorrect: The Following String

This document contains 10 multiple choice questions about C++ programming concepts such as variable naming, functions, data types, operators, and input/output. Each question has one correct answer choice and three incorrect choices. The questions cover topics like variable scope and value, arithmetic and logical operators, function definitions, input parsing, and mathematical operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Question 1

1 / 1 pts
The following string:
 
12_Angry_Men
 

  
must not be used as a variable name
 

  
may be used as a variable name
 
 
IncorrectQuestion 2
0 / 1 pts
A C++ language program may contain:

  
exactly one function named main
 

  
any number of functions named main
 

  
no function named main
 
 
Question 3
1 / 1 pts
A number written like this:
 
007
 

  
is an integer coded as a decimal number
 

  
is an integer coded as a hexadecimal number
 

  
is an integer coded as an octal number
 
 
Question 4
1 / 1 pts
What is the value of the var variable after the execution of the following snippet of
code:

    int var;


    var = 10; /*
    var = var + 10;
    */ var = var + var;
    // var = var + var;
 

  
10
 

  
20
 

  
80
 

  
40
 
 
IncorrectQuestion 5
0 / 1 pts
What is the value of the var variable after the execution of the following snippet of
code:
float var;
var = .1;
var = var + 1.;
var = var + 1e1;
var = var + 1e-2;
 

  
111.1
 

  
11.11
 

  
1.111
 

  
0.1111
 
 
Question 6
1 / 1 pts
What is the value of the k variable after the execution of the following snippet of
code:

int i,j,k;
i = 10;
j = 3;
k = (i % j * i / 3) / (j % i - j / i);
 

  
1
 

  
2
 

  
1.5
 

  
2.5
 
 
IncorrectQuestion 7
0 / 1 pts
Since the ASCII code of 'X' is equal to 88, then the ASCII code of 'Z' is equal to:

  
89
 

  
91
 

  
90
 

  
92
 
 
IncorrectQuestion 8
0 / 1 pts
What is displayed on the screen if the user enters the value of 10 as the input?

#include <iostream>
using namespace std;
int main(void) {
    int i,j;
    cin >> i;
    j = i;
    if (i >= 9)
        i += 9 - i;
    j /= i;
    cout << j;
    return 0;
}
 

  
1
 

  
2
 

  
0
 

  
This cannot be predicted.
 
 
IncorrectQuestion 9
0 / 1 pts
What is displayed on the screen if the user enters the value of 3.0 as the input?

#include <iostream>
using namespace std;
int main(void) {
    float a,b;
    cin >> a;
    b = a / 2;
    if (b >= 1)
        a += b;
    if (a > b)
        b += a;
    cout << a + b;
    return 0;
}
 

  
8.5
 

  
This cannot be predicted.
 
  
10.5
 

  
4.5
 
 
IncorrectQuestion 10
0 / 1 pts
What is displayed on the screen if the user enters the value of 2.0 as the input?

#include <iostream>
#include <cmath>
using namespace std;
int main(void) {
    float a;
    cin >> a;
    a *= a;
    a *= a;
    a = sqrtf(a) * sqrtf(a);
    cout << a;
    return 0;
}
 

  
32
 

  
4
 

  
16
 

  
8
 
https://1384142.netacad.com/courses/1088768

https://www.netacad.com/portal/learning

You might also like