Interview Questions and Answers for 'Char' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Char' - 16 question(s) found - Order By Newest

Frequently asked at Manhattan Associates ( Based on 2 feedback )
  Q1. What is a Lambda Expression ? What's its use ?Core Java
Ans. Its an anonymous method without any declaration.

Lambda Expression are useful to write shorthand Code and hence saves the effort of writing lengthy Code.

It promotes Developer productivity, Better Readable and Reliable code.

  Sample Code for lambda

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

   Like         Discuss         Correct / Improve     java   java8   lambda expression   architecture     Asked in 58 Companies      expert        frequent

Try 1 Question(s) Test


 Q2. What is a stream and what are the types of Streams and classes of the Streams?Core Java
Ans. A Stream is an abstraction that either produces or consumes information. There are two types of Streams :

Byte Streams: Provide a convenient means for handling input and output of bytes.

Character Streams: Provide a convenient means for handling input & output of characters.

Byte Streams classes: Are defined by using two abstract classes, namely InputStream and OutputStream.

Character Streams classes: Are defined by using two abstract classes, namely Reader and Writer.

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

   Like         Discuss         Correct / Improve     java   file io   streams   byte stream   character stream  file handling     Asked in 3 Companies


 Q3. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
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


  Q4. What is JSON ?Json
Ans. JSON is "JavaScript Object Notation", primarily used for client-server or server-server communication. Its a much lighter and readable alternative to XML. JSON is language independent and is easily parse-able in all programming languages.

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

   Like         Discuss         Correct / Improve     json   markup language   client server communication     Asked in 26 Companies      basic        frequent

Try 2 Question(s) Test


 Q5. 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


 Q6. 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


 Q7. What are ascii values for capital and lower case alphabets ?Core Java
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


 Q8. What is unicode ?Core Java
Ans. A way of encoding characters as binary numbers. The Unicode character set includes
characters used in many languages, not just English. Unicode is the character set that is
used internally by Java.

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

   Like         Discuss         Correct / Improve     java   character encoding   unicode   architecture


 Q9. How many bits are used to represent Unicode ?

a. 8 bits
b. 16 bits
c. 24 bits
d. 32 bits
Ans. 16 bits

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

   Like         Discuss         Correct / Improve     java   character coding   character encoding


 Q10. What is multilevel inheritance ?Core Java
Ans. Multi Level Inheritance is multi level hierarchy of classes. Here is the example - http://www.buggybread.com/2015/09/java-se-class-diagram-classes-that_603.html

Class RoleList extends ArrayList which in turn extends AbstractList which in turn extends AbstractCollection.

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

   Like         Discuss         Correct / Improve     multilevel inheritance  object oriented programming (oops)  oops concepts  inheritance  object oriented programming (oops)  oops concepts  oops concepts     Asked in 3 Companies      basic

Try 1 Question(s) Test


 Q11. Write a Program to print count of each character in a String.Core Java
Ans. public class BuggyBread {
public static void main(String args[]) {
Map<Character, Integer> countMap = new HashMap();
String str = "hello world";
for (char character : str.toCharArray()) {
if (countMap.containsKey(character)) {
countMap.put(character, countMap.get(character) + 1);
} else {
countMap.put(character, 1);
}
}
System.out.println(countMap);
}
}

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

   Like         Discuss         Correct / Improve     String  Code  Coding  Character     Asked in 1 Companies


 Q12. Are char,String and Char data types in java ? Core Java
Ans. char is a primitive data type. String is a class. Char is a wrapper class for primitive char.

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

   Like         Discuss         Correct / Improve     char  string  data type      Basic


 Q13. How can we convert char into a String ?Core Java
Ans. We can use StringBuilder. StringBuilder accepts char as the argument for it's constructor.

new StringBuilder('').toString();

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

   Like         Discuss         Correct / Improve     convert char to String  char  String


 Q14. How can we check if a particular character is upper case in Java ?Core Java
Ans. 1. We can compare the ascii value of the character. Ascii for Capital case character is from 65 to 90.

2. We can compare to see if lowerCase of the character is not equal to character itself.

For example -

if character is 'a' the following code

new StringBuilder(char).toString().toLowerCase().equals(new StringBuilder(char)

will return true and hence char is lower case

if character is 'A' the following code

new StringBuilder(char).toString().toLowerCase().equals(new StringBuilder(char)

will return false and hence char is upper case

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

   Like         Discuss         Correct / Improve     check upper case character  character


 Q15. How can we convert String into Char array and vice versa ?Core Java
Ans. There is a method toCharArray() within String class that can be used to convert string to char array.

string.toCharArray();

String class has an argument constructor that takes a char array and create a string

new String(charArray);

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

   Like         Discuss         Correct / Improve     string  char array


 Q16. How can we convert a character or a character array into a String ?Core Java
Ans. String has an argument constructor that take char array as argument and creates a string.

There is no constructor available with String that takes in a character and creates a String. We can use StringBuilder which has a char argument constructor.

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

   Like         Discuss         Correct / Improve     character  char  char array  String  char to String  char array to String



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: