Qantler Technologies – Interview Questions with Answers – Part – 2
This blog explains about Qantler Technologies – Interview Questions with Answers – Part – 2
We have already about some Qantler Technologies – Fresher Interview Questions with Answers – Part – 1 in the previous blog . Here are some questions .
7 . List few concepts of OOPs ?
Core OOPS concepts are:
Abstraction
Encapsulation
Polymorphism
Inheritance
Association
Aggregation
Composition
Abstraction
Abstraction is the concept of hiding the internal details and describing things in simple terms. For example, a method that adds two integers.
Encapsulation
Encapsulation is the technique used to implement abstraction in object oriented programming. Encapsulation is used for access restriction to a class members and methods.
Polymorphism
Polymorphism is the concept where an object behaves differently in different situations. There are two types of polymorphism – compile time polymorphism and runtime polymorphism.
Inheritance
Inheritance is the object oriented programming concept where an object is based on another object. The object that is getting inherited is called superclass and the object that inherits the superclass is called subclass.
8 . Laptop configuration
These are the most important things to consider when choosing a new laptop.
Choosing a 12.5 to 14-inch screens offer the best balance between usability and portability. Larger screens are fine if you don’t travel much and smaller models are great for kids.
- If you’re spending over $600, shoot for these minimum specs:
- Core i5 CPU
- 1920 x 1080 screen
- 8GB of RAM
- SSD Storage instead of a hard drive.
- 8+ hours of battery lifeis ideal if you plan to take your laptop anywhere at all.
- Consider a 2-in-1if you want to use your laptop as a tablet. If not, a standard clamshell notebook may be a better choice.
- Chromebooks are good for kids. Windows laptopsand MacBooks both offer plenty of functionality; which platform you prefer is a matter of personal taste.
9 . Fibonacci series
Fibonacci Series in C++
Fibonacci Series in C++: In case of fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21 etc. The first two numbers of fibonacci series are 0 and 1.
There are two ways to write the fibonacci series program:
- Fibonacci Series without recursion
- Fibonacci Series using recursion
Fibonaccci Series in C++ without Recursion
Let’s see the fibonacci series program in C++ without recursion.
- #include <iostream>
- usingnamespace std;
- intmain() {
- int n1=0,n2=1,n3,i,number;
- cout<<“Enter the number of elements: “;
- cin>>number;
- cout<<n1<<” “<<n2<<” “; //printing 0 and 1
- for(i=2;i<number;++i) //loop starts from 2 because 0 and 1 are already printed
- {
- n3=n1+n2;
- cout<<n3<<” “;
- n1=n2;
- n2=n3;
- }
- return0;
- }
Output:
Enter the number of elements: 100 1 1 2 3 5 8 13 21 34
10 . Factorial using recursion
The factorial is normally used in Combinations and Permutations (mathematics).
There are many ways to write the factorial program in java language. Let’s see the 2 ways to write the factorial program in java.
- Factorial Program using loop
- Factorial Program using recursion
Factorial Program using loop in java
Let’s see the factorial Program using loop in java.
- classFactorialExample{
- public static void main(String args[]){
- int i,fact=1;
- int number=5;//It is the number to calculate factorial
- for(i=1;i<=number;i++){
- fact=fact*i;
- }
- out.println(“Factorial of “+number+” is: “+fact);
- }
- }
Output:
Factorial of 5 is: 120
11 . Combination of two matrices
Combinations from n arrays picking one element from each array
Given a list of arrays, find all combinations where each combination contains one element from each given array.
Examples:
Input : [ [1, 2], [3, 4] ]
Output : 1 3
1 4
2 3
2 4
Input : [ [1], [2, 3, 4], [5] ]
Output : 1 2 5
1 3 5
1 4 5
12 . Biggest third number
The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
1. import java.util.Scanner;
2. public class Biggest_Number
3. {
4. public static void main(String[] args)
5. {
6. int x, y, z;
7. Scanner s = new Scanner(System.in);
8. System.out.print(“Enter the first number:”);
9. x = s.nextInt();
10. System.out.print(“Enter the second number:”);
11. y = s.nextInt();
12. System.out.print(“Enter the third number:”);
13. z = s.nextInt();
14. if(x > y && x > z)
15. {
16. System.out.println(“Largest number is:”+x);
17. }
18. else if(y > z)
19. {
20. System.out.println(“Largest number is:”+y);
21. }
22. else
23. {
24. System.out.println(“Largest number is:”+z);
25. }
26.
27. }
28. }
Output:
$ javac Biggest_Number.java
$ java Biggest_Number
Enter the first number:10
Enter the second number:17
Enter the third number:15
Largest number is:17
REFERENCES : Qantler Technologies – Fresher Interview Questions with Answers
https://payilagam.com/blogs/qantler-fresher-interview-questions-with-answers/
https://www.journaldev.com/12496/oops-concepts-java-example
https://www.laptopmag.com/articles/laptop-buying-guide
https://www.javatpoint.com/fibonacci-series-in-cpp
https://www.geeksforgeeks.org/combinations-from-n-arrays-picking-one-element-from-each-array/
https://www.sanfoundry.com/java-program-find-biggest-3-numbers/
https://www.geeksforgeeks.org/java-program-for-program-to-find-largest-element-in-an-array/