MCQ Single Best Answer Easy

QThe size of '\n' is:

ID: #24253 ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER 35 views
Question Info
#24253Q ID
EasyDifficulty
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPERTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A 2 bytes
  • B 4 bytes
  • C 8 bytes
  • D 16 bytes
Correct Answer: Option A

Explanation

Step 1: What is '\n' in Java?

  • '\n' is a character literal → newline character.

  • In Java, every character is stored in char type.


Step 2: Size of char in Java

  • Unlike C/C++, where char is 1 byte,

  • In Java, char is always 2 bytes (16 bits) because Java uses Unicode.


Step 3: Therefore

  • '\n' is simply a char, so its size = 2 bytes.


Answer: (a) 2 bytes

No Previous Next Question

Share This Question

Challenge a friend or share with your study group.