Interview Questions and Answers - Order By Rating Q1201. What are the restrictions on querying Cassandra Tables ? Cassandra
Ans. Cassandra Tables can only be queried using the partition key and then cluster keys, so all queries should have partition key for sure. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cassandra Asked in 1 Companies Q1202. Can we query Cassandra Tables without specifying the partition id in the where clause ? Cassandra
Ans. No. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cassandra Q1203. How different is the Search algorithm when we query Cassandra Tables and When we query Oracle Tables ? Cassandra
Ans. Relational Database uses linear search if we don't query using indices. Performance for linear search is O(n). If indices have been used , relational database uses binary search. Performance for binary search is O(Log n).
Casandra uses hash search. Performance for Hash Search is O(1). Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cassandra vs oracle  nosql vs relational  search algorithm Q1204. How Cassandra provides better Read performance than Oracle Indices ? Database
Ans. Cassandra uses Hash Search which provides a look time of O(1) whereas Oracle Indices uses Binary Search that provide a lookup time of O(Log n). Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cassandra  hash search  hash search vs binary search Q1205. Is Cassandra read optimized or Write optimized ? Cassandra
Ans. Read optimized Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cassandra Asked in 1 Companies Q1206. Kafka has a deliver atleast once default Policy, What are the other policies that can be configured with Kafka ? Apache Kafka
Ans. Exactly once and At Max Once Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  kafka Q1207. Can we mock static methods ? Testing
Ans. Yes we can use PowerMock. With Mockito , we cannot mock static methods. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  mocking fraeworks  mocking static methods  mockito Q1208. What are the advantage of Abstract classes over interfaces with respect to Java 7 ? and What changed in Java 8 to help facilitate that in Java 8 ? Core Java
Ans. Abstract Classes provide default implementations of methods that are inherited by the classes that extend them, which was not the case for Interfaces. This changed in Java 8, where default implementations are provided for methods. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  abstract classes  interfaces  default method Asked in 1 Companies expert Q1209. How can we makes sure that message has been consumed properly from Kafka ? Apache Kafka
Ans. We can have a mechanism to send the conformation back to Kafka so that Kafka can do offset only after receiving the confirmation. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  apache kafka  kafka  kafka consumer Q1210. Difference between stateless and stateful rest services ? Rest
This question was recently asked at 'Sofi'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  rest services  stateful rest service  stateless rest service Asked in 1 Companies Q1211. What is the difference between stream and parallel stream ? Core Java
Ans. streams are used for sequential processing of data and parallel streams are used for parallel processing of data (only if the underlying processor is multicore). Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  stream vs parallel stream  stream  parallel stream Asked in 1 Companies Q1212. Given a collection of Employee objects, how can we get the customers with name starting with 'A' using lambda expression. Core Java
Ans. List emp = Arrays.asList("American", "Indian", "Finn");
emp.stream().filter(em -> em.startsWith("A")).forEach(System.out.println); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java8  java 8  lambda Asked in 1 Companies Q1213. If a Map needs to be accessed simultaneously by multiple threads, which collection class should be used ? Core Java
Ans. ConcurrentHashMap Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  map  concurrenthashmap  multithreading Q1214. How can we make sure that we don't receive duplicate messages from the Kafka Topic ? Apache Kafka
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  kafka Q1215. Can we have a sub enum within an enum ? Core Java
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  enum  enum within enum Q1216. Can an enum extend another enum ? Core Java
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  enum Q1217. How do you design microservices? Design
This question was recently asked at 'Citigroup Bank,Sofi'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  microservices Asked in 2 Companies Q1218. Can we instantiate the object of derived class if parent constructor is private ? Core Java
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  constructor  private constructor Q1219. What features would you like to see in Java 10 ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java10  java 10 Q1220. In case of generic class declared like following , What can T hold
class MyClass<T>{
T element;
} Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  generics Q1221. Which of the two - iteration or recursion - is slower ? Core Java
Ans. Any function call is slower than the code in the same method as Java has to maintain stack of meta and function call information. So recursion is slower. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  iteration  recursion  iteration vs recursion Q1222. In the following code, which text will get printed immediately after Hello
for(int countx=0;countx<10;count++){
System.out.println("World");
for(int countx=0;countx<10;count++){
System.out.println("Friend");
for(int countx=0;countx<10;count++){
System.out.println("Hello");
break;
}
System.out.println("Buddy");
}
}
Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  break statement Q1223. As root, if you have to assign the owner for the file and set only read permission for the owner, Write a unix command to do it. Unix
Ans. chmod 477 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  unix commands  setting file permissions  chown  chmod Q1224. What do we mean by a Data Type ? Core Java
Ans. if you have similar type of data or objects or entities, then we can give them a type with unique name. And this name will be our Data type. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  data type Q1225. Why shouldn't we use string concatenation extensively or in a loop ? Core Java
Ans. Because String being an immutable object creates a new object upon each concatenation cycle. If there is any such need , we should use String Builder whose objects are mutable. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string  string immutable  immutability  for loop  control statements  loop statement Asked in 1 Companies Q1226. How is string object immutable if we can concat a string to it ? Core Java
Ans. Because it doesn't make the change in the existing string but would create a new string by concatenating the new string to previous string. So Original string won't get changed but a new string will be created. That is why when we say
str1.concat("Hello");
It means nothing because we haven't specified the reference to the new string and we have no way to access the new concatenated string. Accessing str1 with the above code will still give the original string. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  string  string immutable  immutability  string concat Q1227. Does Wrapper classes produces immutable objects ? Core Java
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  wrapper classes  immutable  immutability Q1228. Why Java is considered more purer object oriented language than C++ ? Core Java
Ans. Because of
lack of use of pointers,
Lack of structural programming and
Lack of Multiple Inheritance Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  oops  java vc c++ Q1229. Why is Java such an important Programming language ? Core Java
Ans. Because of following features
Object Oriented and hence helps build maintainable and easily enhanceable code.
Platform Independence and hence can be executed anywhere
Fast due to JIT compiler Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1230. Is dependency injection possible if we don't have inheritance / Composition ? Design
Ans. Without composition - No, as it's the core of dependency injection.
With Inheritance - Yes, through interface implementation. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  dependency injection  inversion of control  ioc