by

What will be the output of the following C++ code?

#include<iostream>
using namespace std;
int main ()
{
   int cin;
   cin >> cin;
   cout << "cin: " << cin;
   return 0;
}

a) Segmentation fault
b) Nothing is printed
c) Error
d) cin: garbage value

1 Answer

0 votes
by

Answer: d
Explanation: cin is a variable hence overrides the cin object. cin >> cin has no meaning so no error.

Related questions

0 votes
    Which of the following is used to terminate the function declaration in C++? a) ; b) ] c) ) d) :...
asked Oct 19, 2022 in Education by JackTerrance
0 votes
    Which of the following correctly declares an array in C++? a) array{10}; b) array array[10]; c) int array; d) int array[10];...
asked Oct 19, 2022 in Education by JackTerrance
0 votes
    Which keyword is used to define the macros in c++? a) #macro b) #define c) macro d) define...
asked Oct 19, 2022 in Education by JackTerrance
0 votes
    Which is more effective while calling the C++ functions? a) call by object b) call by pointer c) call by value d) call by reference...
asked Oct 19, 2022 in Education by JackTerrance
0 votes
    What is the use of the indentation in c++? a) r distinguishes between comments and inner data b) distinguishes ... and code d) r distinguishes between comments and outer data...
asked Oct 19, 2022 in Education by JackTerrance
0 votes
    What is the size of wchar_t in C++? a) Based on the number of bits in the system b) 2 or 4 c) 4 d) 2...
asked Oct 19, 2022 in Education by JackTerrance
0 votes
    - What will be the output of the following C code? #include int main() { int i = 97, *p=&i; foo( ... (D) Segmentation fault/code crash Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    What will be the output of the following Python code? >>>list1 = [1, 3] >>>list2 = list1 >>>list1[0] = 4 >>>print(list2) a) [1, 4] b) [1, 3, 4] c) [4, 3] d) [1, 3]...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python code? print('*', "abcde".center(6), '*', sep='') a) * abcde * b) *abcde * c) * abcde* d) * abcde *...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python code? print("abc. DEF".capitalize()) a) Abc. def b) abc. def c) Abc. Def d) ABC. DEF...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python code? class tester: def __init__(self, id): self.id = str(id) id="224" >>>temp ... >>>print(temp.id) a) 12 b) 224 c) None d) Error...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python code? print("abc. DEF".capitalize()) a) Abc. def b) abc. def c) Abc. Def d) ABC. DEF...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python code? class tester: def __init__(self, id): self.id = str(id) id="224" >>>temp ... >>>print(temp.id) a) 12 b) 224 c) None d) Error...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python code snippet? for i in [1, 2, 3, 4][::-1]: print (i) a) 4 3 2 1 b) error c) 1 2 3 4 d) none of the mentioned...
asked Jan 2, 2023 in Technology by JackTerrance
0 votes
    What will be the output of the following Python code? x = 'abcd' for i in x: print(i.upper()) a)a B C D b) a b c d c) error d)A B C D...
asked Jan 2, 2023 in Technology by JackTerrance
...