Java - Interview Questions and Answers for 'Ascii' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Ascii' - 5 question(s) found - Order By Newest

 Q1. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Anonymous
Ans. Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     character coding   ascii   unicode   utf

Try 1 Question(s) Test


 Q2. What will be the output of following code ?

System.out.println((int)'a');

Ans. The ascii value of a i.e 97

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     character  ascii


 Q3. What will be the output of

System.out.println((Integer)'a');

Ans. It will result in compilation error as primitive char cannot be casted to Integer object, alternatively we can cast it to primitive int like following

System.out.println((int)'a');

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     character  ascii


 Q4. What are ascii values for capital and lower case alphabets ?Core Java2017-07-29 10:00:25

Ans. 65 to 90 for capital case alphabets

97 to 122 for lower case alphabets

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     ascii  character  char


 Q5. Write a Program to print ascii value of each character of a string

Ans. public static void main(String[] args) {
String str = "We are not in Kansas anymore";
for(char character: str.toCharArray()){
System.out.println((int)character);
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like      Discuss      Correct / Improve     ascii  character




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: