Question: 1 -
Which operator is having the right to left associativity in the following?
-
Addition and subtraction
-
Function call
-
Array subscripting
-
Type cast
Answer:
Type cast
Solution not available.
Question: 2 -
In which direction does the assignment operation will take place?
-
left to right
-
bottom to top
-
top to bottom
-
right to left
Answer:
right to left
Solution:
In assignment operation, the flow of execution will be from right to left only.
In assignment operation, the flow of execution will be from right to left only.
Question: 3 -
What are the essential operators in c++?
-
All of the mentioned
-
|
-
+
-
<=
Answer:
All of the mentioned
Solution:
Explanation: Essential operators in c++ are +, |, <=.
Explanation: Essential operators in c++ are +, |, <=.
Question: 4 -
What will be the output of the following C++ code?#include <iostream>
using namespace std;
int main() {
int a, b;
a = 10;
b = 4;
a = b;
b = 7;
cout << "a: " << a;
cout << "\nb: " << b;
return 0;
}
-
a:4 b:6
-
a:10 b:4
-
a:4 b:10
-
a:4 b:7
Answer:
a:4 b:7
Solution:
In this program, we are reassigning the values of a and b because of this we got the output as a:4 b:7
In this program, we are reassigning the values of a and b because of this we got the output as a:4 b:7
Question: 5 -
Pick out the compound assignment statement.
-
a = a + 5
-
a = a / b
-
a = a – 5
-
a -= 5
Answer:
a -= 5
Solution:
When we want to modify the value of a variable by performing an operation on the value currently stored, We will use compound assignment statement. In this option, a -=5 is equal to a = a-5.
When we want to modify the value of a variable by performing an operation on the value currently stored, We will use compound assignment statement. In this option, a -=5 is equal to a = a-5.