Hot Topics
ZOHO Solution
Technical Round
- Question 1
What is the difference between interface and abstract class?
- Answer
Interface | Abstract class |
1. Interface supports the concept of multiple inheritance. | Abstract class doesn’t support the concept of multiple inheritance. |
2. Interface has only abstract methods. | Abstract class can have non-abstract method but it must have at least one abstract method. |
3. Interface keyword is used to declare interface | Abstract keyword is used to declare Abstract class. |
4. Interface has members as public by default. | Abstract class in Java can have private, protected, public and default class members. |
5. Interface supports multiple inheritance. | Abstract class does not support multiple inheritance. |
- Question 2
Tell me about your project.
- Answer
Tell about Your Project.
- Question 3
Which programming language are you most comfortable with?
- Answer
Tell the programming language with which you are most comfortable as interviewer may have follow up questions from that language.
- Question 4
Write a code for the palindrome of a number.
- Answer
#include<stdio.h>
int main() {
int n,m,sum=0,temp;
printf("Enter the number you want to check\n");
scanf("%d",&n);
temp=n;
while(n>0){
m=n%10;
sum=(sum*10)+m;
n=n/10;
}
if(temp==sum){
printf("It's a palindrome number");
}
else{
printf("It's not a palindrome number");
}
return 0;
}
/*
output:
Enter the number you want to check:121
121 , It's a palindrome number
*/
- Question 5
Write a code for the factorial of a number.
- Answer
#include<stdio.h>
int fact(int);
int main()
{
int n=5;
printf("%d",fact(n));
return 0;
}
int fact(int n){
if(n==1){
return 1;
}
return n*fact(n-1);
}
/*
OUTPUT:
120
*/
- Question 6
How will you declare a function in C?
- Answer
To declare a function in C we at first need to declare the prototype of function before main function and then after main function ends we will write the function.
- Question 7
What is inheritance?
- Answer
Inheritance is a mechanism in which an object acquires properties from its parent object.
- Question 8
What was your recent technical project that you worked on? What were your key responsibility?
- Answer
Tell about the project you recently worked on and also tell the part of the project on which you have worked on.
- Question 9
What is the use of printf() and scanf() functions?
- Answer
printf() – printf function is used to print character stream of data on stdout console.
scanf() – scanf function is used to read formatted input from stdin. It returns the whole number of characters written in it otherwise, returns a negative value.
- Question 10
What is the static variable? What is its use?
- Answer
A static variable creates a single copy of the variable and is shared among all the objects at a class level.
- Question 11
What is the difference between call by value and call by reference?
- Answer
Call By Value | Call By Reference |
1. When a copy of a value is passed to the function, then the original value is not modified. | When a copy of value is passed to the function, then the original value is modified. |
2. Actual arguments and formal arguments are created in separated memory locations. | Actual arguments and formal arguments are created is same memory location. |
3. In this case, actual argument remain safe as they cannot be modified. | In this case, actual arguments are not reliable, as they are modified. |
4. The copied of the actual arguments are passed to the formal arguments. | The address of actual arguments are passed to their respective formal arguments |
- Question 12
What is recursion in C?
- Answer
Recursion is a self-calling function with a terminating condition.
- Question 13
What is NULL pointer and far pointer?
- Answer
NULL pointer is a pointer that is pointing to nothing. NULL pointer points to empty location in memory. The value of NULL pointer is 0.
Far pointer is a 32-bit pointer that can access information which is outside the computer memory.
- Question 14
What is a dangling pointer? How is it overcome?
- Answer
A pointer that points to a non-existing memory location is called a dangling pointer. To avoid dangling pointer we can initialize the pointer to the NULL value.
- Question 15
What is an infinite loop?
- Answer
A loop that never terminates and repeats indefinitely is called infinite loop.
- Question 16
What is a command line argument?
- Answer
Argument that is passed before compilation of the program.
- Question 17
Can we compile the program without the main function?
- Answer
Compilation of a program without main() function is possible but it uses main() function indirectly.
- Question 18
What is an object and class?
- Answer
Object: An object is the reality of the class after creation of which we can access the data members and member functions of the classes. Object memory will be occupied separately.
Class: A class in Java is a blueprint which includes all your data. A class contains fields (variables) and methods to describe the behaviour of an object.