Array in C++ Exercise I


Ques 1 Array


What is the output of the following C++ Code?


#include <iostream>  
using namespace std;  
int main()  
{  
      char str[] = {'a', 'b', 'c'};  
      cout << 1[str];  
      return 0;  
}  

  a) 98
  b) 66
  c) A
  d) a


d is the correct option




Ques 2 Array


What is the output of the following C++ Code?


#include <iostream>  
using namespace std;  
int main()  
{  
      char str[] = {'a', 'b', 'c'};  
      cout << -1[str];  
      return 0;  
}  

  a) -98
  b) -66
  c) A
  d) a


a is the correct option