-
Which of the following string dose not represent a valid variable name?
-
What is the output of the following snippet if a string 2.5
followed by Enter is enter through the keyboard?
#include <iostream>
using namespace std;
void f(struct S S) {
S.S[0] = S.S[1] + S.S[2] - 4;
}
int main()
{
float x;
cin >> x;
cout << scientific << "x";
}
-
What is the value of the following literal?
0E1
- The literal is invalid
0
0.1
0.01
-
What is the value of the following literal?
018
16
10
- The literal is invalid
2
-
What is the output of the following snippet if a digit 8
followed by Enter is enter through the keyboard?
#include <iostream>
using namespace std;
int main()
{
int i;
cin >> i;
cout << i << hex << i + i << oct << i;
}
81010
810010
8168
8x10010
-
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;
-
What is the value of the x
variable?
float x = 1. / 2. + 2. / 4.;
-
What is the value of the following literal?
-le-1
-0.1
-10.0
- The literal is invalid.
-1.0
-
Which of the following string represents a legal variable name?
1st_literal_is_invalid
first literal is invalid
first_literal_is_invalid
#1_literal_is_invalid
-
Which of the following string is a correct integer number(in the C++ language sense)?
-
Which of the following string is a proper floating-point number(in the C++ language sense)?
-
What is the value of the following literal?
x10
- The literal is invalid
2
16
10
-
What is the value of the k
variable?
int k = 1 % 2 + 4 % 2;
-
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;
-
What is the value of the k
variable?
int i = 1;
int j = ++i;
int k = j++;
-
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;
}
-
What is the value of the following literal?
010
2
- The literal is invalid
8
10
-
What is the value of the following literal?
0x1A
16
6
26
- The literal is invalid
-
What is the value of the i
variable?
float x = 1.0 / 4.0
int i = x;
-
What is the output of the following snippet if a digit 5
followed by Enter is entered throung 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;
}
10545
10-545
10125
10-125