- Get link
- X
- Other Apps
1. Write a Java program to find n fibonacci series ?
2. What is lambda expression in java ?
3. What is use of static keyword in java ?
4. Can we implement multiples interfaces in a single java class ?
5. What is the significance of the "super" and "this" keyword in java ?
6. What is run time polymorphism and how it is achieved in java ?
7. Distinguish between Array and ArrayList provided by java ?
8. What is the "Diamond problem" in java ?
9. How can you differentiate between C, C++ and Java ?
10. Can you differentiate between "var++" and "++var" ?
11. What is normalization in the datebase ?
12. Can you give differences for the Primary Key and Unique Key in SQL ?
13. What is XML ?
Java program for Fibonacci series:
javapublic class Fibonacci {
public static void main(String[] args) { int n = 10, a = 0, b = 1; System.out.print(a + " " + b); for (int i = 2; i < n; i++) { int next = a + b; System.out.print(" " + next); a = b; b = next; } } }Lambda Expression in Java: A way to write functions in a short way. Example:
(a, b) -> a + b
.Use of
static
keyword in Java: Makes something belong to the class, not the object. Example:static
methods can be called without creating an object.Multiple interfaces in one class: Yes, a class can use many interfaces by separating them with commas.
super
andthis
in Java:super
: Refers to the parent class.this
: Refers to the current class.
Runtime polymorphism in Java: When a method is chosen at runtime. Achieved using method overriding.
Array vs. ArrayList:
- Array: Fixed size.
- ArrayList: Can grow in size.
Diamond problem in Java: Happens when a class inherits from two classes that have the same method. Java avoids it by not allowing multiple inheritance with classes.
C, C++, Java differences:
- C: Simple, procedural.
- C++: Adds objects to C.
- Java: Object-oriented, platform-independent.
var++
vs.++var
:
var++
: Use the value, then increase.++var
: Increase first, then use the value.
Normalization in database: Organizing data to avoid duplicates.
Primary Key vs. Unique Key in SQL:
- Primary Key: No duplicates, no nulls.
- Unique Key: No duplicates, but can have one null.
- XML: A language for storing and transporting data. Example:
<tag>data</tag>
.
- Get link
- X
- Other Apps
Comments
Post a Comment