Multiple choice

What would be the output, if the input given to 'a' is Ram Krishan Verma?#include<iostream.h> void main() { char a[10]; cin.getline(a,10); cout<<a; }

  1. Ram Krish

  2. Ram Krisha

  3. Ram Krishan

  4. Ram Krishan Verma

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

cin.getline(a,10) reads up to 9 characters plus null terminator. 'Ram Krishan Verma' is truncated to 'Ram Krish' (9 chars) then null-terminated. getline stops at the buffer limit, preserving whatever fits.