What will be the output of the following C++ code?...
Guiding State PSC aspirants since 2016 50,000+ students · 1,000+ final selections Exam Calendar Results Call 9116926003
pscnotes
Pick your state
APPSC Prelims previous year questions

What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; int main() { string s = "abc"; s[1] = s[2]; cout << s; } Choose the correct option.

Asked in APPSC (Arunachal) Question Booklet (Set-A) of Paper I and Paper II 2026

  1. aab
  2. abb
  3. abc
  4. acc
Show answer

Answer: B. abb

More APPSC Prelims previous year questions questions

All 7,479 APPSC Prelims previous year questions questions →