Live Classes: Upskill your knowledge Now!
Chat NowCreated by - Admin s
A list of 50 top frequently asked C programming interview questions and answers are given below.1) What is C language?C is a mid-level and procedural programming language. The Procedural programming language is also known as the structured programming language is a technique in which large programs are broken down into smaller modules, and each module uses structured code. This technique minimizes error and misinterpretation. More details.2) Why is C known as a mother language?C is known as a mother language because most of the compilers and JVMs are written in C language. Most of the languages which are developed after C language has borrowed heavily from it like C++, Python, Rust, javascript, etc. It introduces new core concepts like arrays, functions, file handling which are used in these languages. More details.3) Why is C called a mid-level programming language?C is called a mid-level programming language because it binds the low level and high -level programming language. We can use C language as a System programming to develop the operating system as well as an Application programming to generate menu driven customer driven billing system. More details.Play Videox4) Who is the founder of C language?Dennis Ritchie. More details.5) When was C language developed?C language was developed in 1972 at bell laboratories of AT&T. More details.6) What are the features of the C language?The main features of C language are given below:Simple: C is a simple language because it follows the structured approach, i.e., a program is broken into partsPortable: C is highly portable means that once the program is written can be run on any machine with little or no modifications.Mid Level: C is a mid-level programming language as it combines the low- level language with the features of the high-level language.Structured: C is a structured language as the C program is broken into parts.Fast Speed: C language is very fast as it uses a powerful set of data types and operators.Memory Management: C provides an inbuilt memory function that saves the memory and improves the efficiency of our program.Extensible: C is an extensible language as it can adopt new features in the future.More details.7) What is the use of printf() and scanf() functions?printf(): The printf() function is used to print the integer, character, float and string values on to the screen.Following are the format specifier:%d: It is a format specifier used to print an integer value.%s: It is a format specifier used to print a string.%c: It is a format specifier used to display a character value.%f: It is a format specifier used to display a floating point value.scanf(): The scanf() function is used to take input from the user.More details.8) What is the difference between the local variable and global variable in C?Following are the differences between a local variable and global variable:Basis for comparisonLocal variableGlobal variableDeclarationA variable which is declared inside function or block is known as a local variable.A variable which is declared outside function or block is known as a global variable.ScopeThe scope of a variable is available within a function in which they are declared.The scope of a variable is available throughout the program.AccessVariables can be accessed only by those statements inside a function in which they are declared.Any statement in the entire program can access variables.LifeLife of a variable is created when the function block is entered and destroyed on its exit.Life of a variable exists until the program is executing.StorageVariables are stored in a stack unless specified.The compiler decides the storage location of a variable.More details.9) What is the use of a static variable in C?Following are the uses of a static variable:A variable which is declared as static is known as a static variable. The static variable retains its value between multiple function calls.Static variables are used because the scope of the static variable is available in the entire program. So, we can access a static variable anywhere in the program.The static variable is initially initialized to zero. If we update the value of a variable, then the updated value is assigned.The static variable is used as a common value which is shared by all the methods.The static variable is initialized only once in the memory heap to reduce the memory usage.More details.10) What is the use of the function in C?Uses of C function are:C functions are used to avoid the rewriting the same code again and again in our program.C functions can be called any number of times from any place of our program.When a program is divided into functions, then any part of our program can easily be tracked.C functions provide the reusability concept, i.e., it breaks the big task into smaller tasks so that it makes the C program more understandable.More details.11) What is the difference between call by value and call by reference in C?Following are the differences between a call by value and call by reference are:Call by valueCall by referenceDescriptionWhen a copy of the value is passed to the function, then the original value is not modified.When a copy of the value is passed to the function, then the original value is modified.Memory locationActual arguments and formal arguments are created in separate memory locations.Actual arguments and formal arguments are created in the same memory location.SafetyIn this case, actual arguments remain safe as they cannot be modified.In this case, actual arguments are not reliable, as they are modified.ArgumentsThe copies of the actual arguments are passed to the formal arguments.The addresses of actual arguments are passed to their respective formal arguments.Example of call by value:#include <stdio.h> void change(int,int); int main() { int a=10,b=20; change(a,b); //calling a function by passing the values of variables. printf("Value of a is: %d",a); printf("\n"); printf("Value of b is: %d",b); return 0; } void change(int x,int y) { x=13; y=17; } Output:Value of a is: 10 Value of b is: 20 Example of call by reference:#include <stdio.h> void change(int*,int*); int main() { int a=10,b=20; change(&a,&b); // calling a function by passing references of variables. printf("Value of a is: %d",a); printf("\n"); printf("Value of b is: %d",b); return 0; } void change(int *x,int *y) { *x=13; *y=17; } Output:Value of a is: 13 Value of b is: 17 More details.12) What is recursion in C?When a function calls itself, and this process is known as recursion. The function that calls itself is known as a recursive function.Recursive function comes in two phases:Winding phaseUnwinding phaseWinding phase: When the recursive function calls itself, and this phase ends when the condition is reached.Unwinding phase: Unwinding phase starts when the condition is reached, and the control returns to the original call.Example of recursion#include <stdio.h> int calculate_fact(int); int main() { int n=5,f; f=calculate_fact(n); // calling a function printf("factorial of a number is %d",f); return 0; } int calculate_fact(int a) { if(a==1) { return 1; } else return a*calculate_fact(a-1); //calling a function recursively. } Output:factorial of a number is 120 More details.13) What is an array in C?An Array is a group of similar types of elements. It has a contiguous memory location. It makes the code optimized, easy to traverse and easy to sort. The size and type of arrays cannot be changed after its declaration.Arrays are of two types:One-dimensional array: One-dimensional array is an array that stores the elements one after the another.Syntax:data_type array_name[size]; Multidimensional array: Multidimensional array is an array that contains more than one array.Syntax:data_type array_name[size]; Example of an array:#include <stdio.h> int main() { int arr[5]={1,2,3,4,5}; //an array consists of five integer values. for(int i=0;i<5;i++) { printf("%d ",arr[i]); } return 0; } Output:1 2 3 4 5 More details.14) What is a pointer in C?A pointer is a variable that refers to the address of a value. It makes the code optimized and makes the performance fast. Whenever a variable is declared inside a program, then the system allocates some memory to a variable. The memory contains some address number. The variables that hold this address number is known as the pointer variable.For example:Data_type *p; The above syntax tells that p is a pointer variable that holds the address number of a given data type value.Example of pointer#include <stdio.h> int main() { int *p; //pointer of type integer. int a=5; p=&a; printf("Address value of 'a' variable is %u",p); return 0; } Output:Address value of 'a' variable is 428781252 More details.15) What is the usage of the pointer in C?Accessing array elements: Pointers are used in traversing through an array of integers and strings. The string is an array of characters which is terminated by a null character '\0'.Dynamic memory allocation: Pointers are used in allocation and deallocation of memory during the execution of a program.Call by Reference: The pointers are used to pass a reference of a variable to other function.Data Structures like a tree, graph, linked list, etc.: The pointers are used to construct different data structures like tree, graph, linked list, etc.16) What is a NULL pointer in C?A pointer that doesn't refer to any address of value but NULL is known as a NULL pointer. When we assign a '0' value to a pointer of any type, then it becomes a Null pointer.More details.17) What is a far pointer in C?A pointer which can access all the 16 segments (whole residence memory) of RAM is known as far pointer. A far pointer is a 32-bit pointer that obtains information outside the memory in a given section.18) What is dangling pointer in C?If a pointer is pointing any memory location, but meanwhile another pointer deletes the memory occupied by the first pointer while the first pointer still points to that memory location, the first pointer will be known as a dangling pointer. This problem is known as a dangling pointer problem.Dangling pointer arises when an object is deleted without modifying the value of the pointer. The pointer points to the deallocated memory.Let's see this through an example.#include<stdio.h> void main() { int *ptr = malloc(constant value); //allocating a memory space. free(ptr); //ptr becomes a dangling pointer. } In the above example, initially memory is allocated to the pointer variable ptr, and then the memory is deallocated from the pointer variable. Now, pointer variable, i.e., ptr becomes a dangling pointer.How to overcome the problem of a dangling pointerThe problem of a dangling pointer can be overcome by assigning a NULL value to the dangling pointer. Let's understand this through an example:#include<stdio.h> void main() { int *ptr = malloc(constant value); //allocating a memory space. free(ptr); //ptr becomes a dangling pointer. ptr=NULL; //Now, ptr is no longer a dangling pointer. } In the above example, after deallocating the memory from a pointer variable, ptr is assigned to a NULL value. This means that ptr does not point to any memory location. Therefore, it is no longer a dangling pointer.19) What is pointer to pointer in C?In case of a pointer to pointer concept, one pointer refers to the address of another pointer. The pointer to pointer is a chain of pointers. Generally, the pointer contains the address of a variable. The pointer to pointer contains the address of a first pointer. Let's understand this concept through an example:#include <stdio.h> int main() { int a=10; int *ptr,**pptr; // *ptr is a pointer and **pptr is a double pointer. ptr=&a; pptr=&ptr; printf("value of a is:%d",a); printf("\n"); printf("value of *ptr is : %d",*ptr); printf("\n"); printf("value of **pptr is : %d",**pptr); return 0; } In the above example, pptr is a double pointer pointing to the address of the ptr variable and ptr points to the address of 'a' variable.More details.20) What is static memory allocation?In case of static memory allocation, memory is allocated at compile time, and memory can't be increased while executing the program. It is used in the array.The lifetime of a variable in static memory is the lifetime of a program.The static memory is allocated using static keyword.The static memory is implemented using stacks or heap.The pointer is required to access the variable present in the static memory.The static memory is faster than dynamic memory.In static memory, more memory space is required to store the variable.For example: int a[10]; The above example creates an array of integer type, and the size of an array is fixed, i.e., 10.More details.21) What is dynamic memory allocation?In case of dynamic memory allocation, memory is allocated at runtime and memory can be increased while executing the program. It is used in the linked list.The malloc() or calloc() function is required to allocate the memory at the runtime.An allocation or deallocation of memory is done at the execution time of a program.No dynamic pointers are required to access the memory.The dynamic memory is implemented using data segments.Less memory space is required to store the variable.For example int *p= malloc(sizeof(int)*10); The above example allocates the memory at runtime.More details.22) What functions are used for dynamic memory allocation in C language?malloc()The malloc() function is used to allocate the memory during the execution of the program.It does not initialize the memory but carries the garbage value.It returns a null pointer if it could not be able to allocate the requested space.Syntaxptr = (cast-type*) malloc(byte-size) // allocating the memory using malloc() function. calloc()The calloc() is same as malloc() function, but the difference only is that it initializes the memory with zero value.Syntaxptr = (cast-type*)calloc(n, element-size);// allocating the memory using calloc() function. realloc()The realloc() function is used to reallocate the memory to the new size.If sufficient space is not available in the memory, then the new block is allocated to accommodate the existing data.Syntaxptr = realloc(ptr, newsize); // updating the memory size using realloc() function. In the above syntax, ptr is allocated to a new size.free():The free() function releases the memory allocated by either calloc() or malloc() function.Syntaxfree(ptr); // memory is released using free() function. The above syntax releases the memory from a pointer variable ptr.More details.23) What is the difference between malloc() and calloc()?calloc()malloc()DescriptionThe malloc() function allocates a single block of requested memory.The calloc() function allocates multiple blocks of requested memory.InitializationIt initializes the content of the memory to zero.It does not initialize the content of memory, so it carries the garbage value.Number of argumentsIt consists of two arguments.It consists of only one argument.Return valueIt returns a pointer pointing to the allocated memory.It returns a pointer pointing to the allocated memory.More details.24) What is the structure?The structure is a user-defined data type that allows storing multiple types of data in a single unit. It occupies the sum of the memory of all members.The structure members can be accessed only through structure variables.Structure variables accessing the same structure but the memory allocated for each variable will be different.Syntax of structurestruct structure_name { Member_variable1; Member_variable2 . . }[structure variables]; Let's see a simple example.#include <stdio.h> struct student { char name[10]; // structure members declaration. int age; }s1; //structure variable int main() { printf("Enter the name"); scanf("%s",s1.name); printf("\n"); printf("Enter the age"); scanf("%d",&s1.age); printf("\n"); printf("Name and age of a student: %s,%d",s1.name,s1.age); return 0; } Output:Enter the name shikha Enter the age 26 Name and age of a student: shikha,26 More details.25) What is a union?The union is a user-defined data type that allows storing multiple types of data in a single unit. However, it doesn't occupy the sum of the memory of all members. It holds the memory of the largest member only.In union, we can access only one variable at a time as it allocates one common space for all the members of a union.Syntax of unionunion union_name { Member_variable1; Member_variable2; . . Member_variable n; }[union variables]; Let's see a simple example#include<stdio.h> union data { int a; //union members declaration. float b; char ch; }; int main() { union data d; //union variable. d.a=3; d.b=5.6; d.ch='a'; printf("value of a is %d",d.a); printf("\n"); printf("value of b is %f",d.b); printf("\n"); printf("value of ch is %c",d.ch); return 0; } Output:value of a is 1085485921 value of b is 5.600022 value of ch is a In the above example, the value of a and b gets corrupted, and only variable ch shows the actual output. This is because all the members of a union share the common memory space. Hence, the variable ch whose value is currently updated.More details.26) What is an auto keyword in C?In C, every local variable of a function is known as an automatic (auto) variable. Variables which are declared inside the function block are known as a local variable. The local variables are also known as an auto variable. It is optional to use an auto keyword before the data type of a variable. If no value is stored in the local variable, then it consists of a garbage value.27) What is the purpose of sprintf() function?The sprintf() stands for "string print." The sprintf() function does not print the output on the console screen. It transfers the data to the buffer. It returns the total number of characters present in the string.Syntaxint sprintf ( char * str, const char * format, ... ); Let's see a simple example #include<stdio.h> int main() { char a[20]; int n=sprintf(a,"javaToint"); printf("value of n is %d",n); return 0;} Output:value of n is 9 28) Can we compile a program without main() function?Yes, we can compile, but it can't be executed.But, if we use #define, we can compile and run a C program without using the main() function. For example:#include<stdio.h> #define start main void start() { printf("Hello"); } More details.29) What is a token?The Token is an identifier. It can be constant, keyword, string literal, etc. A token is the smallest individual unit in a program. C has the following tokens:Identifiers: Identifiers refer to the name of the variables.Keywords: Keywords are the predefined words that are explained by the compiler.Constants: Constants are the fixed values that cannot be changed during the execution of a program.Operators: An operator is a symbol that performs the particular operation.Special characters: All the characters except alphabets and digits are treated as special characters.30) What is command line argument?The argument passed to the main() function while executing the program is known as command line argument. For example:main(int count, char *args[]){ //code to be executed } 31) What is the acronym for ANSI?The ANSI stands for " American National Standard Institute." It is an organization that maintains the broad range of disciplines including photographic film, computer languages, data encoding, mechanical parts, safety and more.32) What is the difference between getch() and getche()?The getch() function reads a single character from the keyboard. It doesn't use any buffer, so entered data will not be displayed on the output screen.The getche() function reads a single character from the keyword, but data is displayed on the output screen. Press Alt+f5 to see the entered character.Let's see a simple example#include<stdio.h> #include<conio.h> int main() { char ch; printf("Enter a character "); ch=getch(); // taking an user input without printing the value. printf("\nvalue of ch is %c",ch); printf("\nEnter a character again "); ch=getche(); // taking an user input and then displaying it on the screen. printf("\nvalue of ch is %c",ch); return 0; } Output:Enter a character value of ch is a Enter a character again a value of ch is a In the above example, the value entered through a getch() function is not displayed on the screen while the value entered through a getche() function is displayed on the screen.33) What is the newline escape sequence?The new line escape sequence is represented by "\n". It inserts a new line on the output screen.More details.34) Who is the main contributor in designing the C language after Dennis Ritchie?Brain Kernighan.35) What is the difference between near, far and huge pointers?A virtual address is composed of the selector and offset.A near pointer doesn't have explicit selector whereas far, and huge pointers have explicit selector. When you perform pointer arithmetic on the far pointer, the selector is not modified, but in case of a huge pointer, it can be modified.These are the non-standard keywords and implementation specific. These are irrelevant in a modern platform.36) What is the maximum length of an identifier?It is 32 characters ideally but implementation specific.37) What is typecasting?The typecasting is a process of converting one data type into another is known as typecasting. If we want to store the floating type value to an int type, then we will convert the data type into another data type explicitly.Syntax(type_name) expression; 38) What are the functions to open and close the file in C language?The fopen() function is used to open file whereas fclose() is used to close file.39) Can we access the array using a pointer in C language?Yes, by holding the base address of array into a pointer, we can access the array using a pointer.40) What is an infinite loop?A loop running continuously for an indefinite number of times is called the infinite loop.Infinite For Loop:for(;;){ //code to be executed } Infinite While Loop:while(1){ //code to be executed } Infinite Do-While Loop:do{ //code to be executed }while(1); 41) Write a program to print "hello world" without using a semicolon?#include<stdio.h> void main(){ if(printf("hello world")){} // It prints the ?hello world? on the screen. } More details.42) Write a program to swap two numbers without using the third variable?#include<stdio.h> #include<conio.h> main() { int a=10, b=20; //declaration of variables. clrscr(); //It clears the screen. printf("Before swap a=%d b=%d",a,b); a=a+b;//a=30 (10+20) b=a-b;//b=10 (30-20) a=a-b;//a=20 (30-10) printf("\nAfter swap a=%d b=%d",a,b); getch(); } More details.43) Write a program to print Fibonacci series without using recursion?#include<stdio.h> #include<conio.h> void main() { int n1=0,n2=1,n3,i,number; clrscr(); printf("Enter the number of elements:"); scanf("%d",&number); printf("\n%d %d",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; printf(" %d",n3); n1=n2; n2=n3; } getch(); } More details.44) Write a program to print Fibonacci series using recursion?#include<stdio.h> #include<conio.h> void printFibonacci(int n) // function to calculate the fibonacci series of a given number. { static int n1=0,n2=1,n3; // declaration of static variables. if(n>0){ n3 = n1 + n2; n1 = n2; n2 = n3; printf("%d ",n3); printFibonacci(n-1); //calling the function recursively. } } void main(){ int n; clrscr(); printf("Enter the number of elements: "); scanf("%d",&n); printf("Fibonacci Series: "); printf("%d %d ",0,1); printFibonacci(n-2);//n-2 because 2 numbers are already printed getch(); } More details.45) Write a program to check prime number in C Programming?#include<stdio.h> #include<conio.h> void main() { int n,i,m=0,flag=0; //declaration of variables. clrscr(); //It clears the screen. printf("Enter the number to check prime:"); scanf("%d",&n); m=n/2; for(i=2;i<=m;i++) { if(n%i==0) { printf("Number is not prime"); flag=1; break; //break keyword used to terminate from the loop. } } if(flag==0) printf("Number is prime"); getch(); //It reads a character from the keyword. } More details.46) Write a program to check palindrome number in C Programming?#include<stdio.h> #include<conio.h> main() { int n,r,sum=0,temp; clrscr(); printf("enter the number="); scanf("%d",&n); temp=n; while(n>0) { r=n%10; sum=(sum*10)+r; n=n/10; } if(temp==sum) printf("palindrome number "); else printf("not palindrome"); getch(); } More details.47) Write a program to print factorial of given number without using recursion?#include<stdio.h> #include<conio.h> void main(){ int i,fact=1,number; clrscr(); printf("Enter a number: "); scanf("%d",&number); for(i=1;i<=number;i++){ fact=fact*i; } printf("Factorial of %d is: %d",number,fact); getch(); } More details.48) Write a program to print factorial of given number using recursion?#include<stdio.h> #include<conio.h> long factorial(int n) // function to calculate the factorial of a given number. { if (n == 0) return 1; else return(n * factorial(n-1)); //calling the function recursively. } void main() { int number; //declaration of variables. long fact; clrscr(); printf("Enter a number: "); scanf("%d", &number); fact = factorial(number); //calling a function. printf("Factorial of %d is %ld\n", number, fact); getch(); //It reads a character from the keyword. } More details.49) Write a program to check Armstrong number in C?#include<stdio.h> #include<conio.h> main() { int n,r,sum=0,temp; //declaration of variables. clrscr(); //It clears the screen. printf("enter the number="); scanf("%d",&n); temp=n; while(n>0) { r=n%10; sum=sum+(r*r*r); n=n/10; } if(temp==sum) printf("armstrong number "); else printf("not armstrong number"); getch(); //It reads a character from the keyword. } More details.50) Write a program to reverse a given number in C?#include<stdio.h> #include<conio.h> main() { int n, reverse=0, rem; //declaration of variables. clrscr(); // It clears the screen. printf("Enter a number: "); scanf("%d", &n); while(n!=0) { rem=n%10; reverse=reverse*10+rem; n/=10; } printf("Reversed Number: %d",reverse); getch(); // It reads a character from the keyword. }
More detailsPublished - Mon, 05 Dec 2022
Created by - Admin s
A list of top frequently asked C++ interview questions and answers are given below.1) What is C++?C++ is an object-oriented programming language created by Bjarne Stroustrup. It was released in 1985.C++ is a superset of C with the major addition of classes in C language.Initially, Stroustrup called the new language "C with classes". However, after sometime the name was changed to C++. The idea of C++ comes from the C increment operator ++.68.2M1.3KException Handling in Java - Javatpoint2) What are the advantages of C++?C++ doesn't only maintains all aspects from C language, it also simplifies memory management and adds several features like:C++ is a highly portable language means that the software developed using C++ language can run on any platform.C++ is an object-oriented programming language which includes the concepts such as classes, objects, inheritance, polymorphism, abstraction.C++ has the concept of inheritance. Through inheritance, one can eliminate the redundant code and can reuse the existing classes.Data hiding helps the programmer to build secure programs so that the program cannot be attacked by the invaders.Message passing is a technique used for communication between the objects.C++ contains a rich function library.3) What is the difference between C and C++?Following are the differences between C and C++:CC++C language was developed by Dennis Ritchie.C++ language was developed by Bjarne Stroustrup.C is a structured programming language.C++ supports both structural and object-oriented programming language.C is a subset of C++.C++ is a superset of C.In C language, data and functions are the free entities.In the C++ language, both data and functions are encapsulated together in the form of a project.C does not support the data hiding. Therefore, the data can be used by the outside world.C++ supports data hiding. Therefore, the data cannot be accessed by the outside world.C supports neither function nor operator overloading.C++ supports both function and operator overloading.In C, the function cannot be implemented inside the structures.In the C++, the function can be implemented inside the structures.Reference variables are not supported in C language.C++ supports the reference variables.C language does not support the virtual and friend functions.C++ supports both virtual and friend functions.In C, scanf() and printf() are mainly used for input/output.C++ mainly uses stream cin and cout to perform input and output operations.4) What is the difference between reference and pointer?Following are the differences between reference and pointer:ReferencePointerReference behaves like an alias for an existing variable, i.e., it is a temporary variable.The pointer is a variable which stores the address of a variable.Reference variable does not require any indirection operator to access the value. A reference variable can be used directly to access the value.Pointer variable requires an indirection operator to access the value of a variable.Once the reference variable is assigned, then it cannot be reassigned with different address values.The pointer variable is an independent variable means that it can be reassigned to point to different objects.A null value cannot be assigned to the reference variable.A null value can be assigned to the reference variable.It is necessary to initialize the variable at the time of declaration.It is not necessary to initialize the variable at the time of declaration.5) What is a class?The class is a user-defined data type. The class is declared with the keyword class. The class contains the data members, and member functions whose access is defined by the three modifiers are private, public and protected. The class defines the type definition of the category of things. It defines a datatype, but it does not define the data it just specifies the structure of data.You can create N number of objects from a class.6) What are the various OOPs concepts in C++?The various OOPS concepts in C++ are:Class:The class is a user-defined data type which defines its properties and its functions. For example, Human being is a class. The body parts of a human being are its properties, and the actions performed by the body parts are known as functions. The class does not occupy any memory space. Therefore, we can say that the class is the only logical representation of the data.The syntax of declaring the class:class student { //data members; //Member functions } Object:An object is a run-time entity. An object is the instance of the class. An object can represent a person, place or any other item. An object can operate on both data members and member functions. The class does not occupy any memory space. When an object is created using a new keyword, then space is allocated for the variable in a heap, and the starting address is stored in the stack memory. When an object is created without a new keyword, then space is not allocated in the heap memory, and the object contains the null value in the stack.class Student { //data members; //Member functions } The syntax for declaring the object:Student s = new Student(); Inheritance:Inheritance provides reusability. Reusability means that one can use the functionalities of the existing class. It eliminates the redundancy of code. Inheritance is a technique of deriving a new class from the old class. The old class is known as the base class, and the new class is known as derived class.Syntaxclass derived_class :: visibility-mode base_class; Note: The visibility-mode can be public, private, protected.Encapsulation:Encapsulation is a technique of wrapping the data members and member functions in a single unit. It binds the data within a class, and no outside method can access the data. If the data member is private, then the member function can only access the data.Abstraction:Abstraction is a technique of showing only essential details without representing the implementation details. If the members are defined with a public keyword, then the members are accessible outside also. If the members are defined with a private keyword, then the members are not accessible by the outside methods.Data binding:Data binding is a process of binding the application UI and business logic. Any change made in the business logic will reflect directly to the application UI.Polymorphism:Polymorphism means multiple forms. Polymorphism means having more than one function with the same name but with different functionalities. Polymorphism is of two types:Static polymorphism is also known as early binding.Dynamic polymorphism is also known as late binding.7) What are the different types of polymorphism in C++?Polymorphism: Polymorphism means multiple forms. It means having more than one function with the same function name but with different functionalities.Polymorphism is of two types:Runtime polymorphismRuntime polymorphism is also known as dynamic polymorphism. Function overriding is an example of runtime polymorphism. Function overriding means when the child class contains the method which is already present in the parent class. Hence, the child class overrides the method of the parent class. In case of function overriding, parent and child class both contains the same function with the different definition. The call to the function is determined at runtime is known as runtime polymorphism.Let's understand this through an example:#include <iostream> using namespace std; class Base { public: virtual void show() { cout<<"javaTpoint"; } }; class Derived:public Base { public: void show() { cout<<"javaTpoint tutorial"; } }; int main() { Base* b; Derived d; b=&d; b->show(); return 0; } Output:javaTpoint tutorial Compile time polymorphismCompile-time polymorphism is also known as static polymorphism. The polymorphism which is implemented at the compile time is known as compile-time polymorphism. Method overloading is an example of compile-time polymorphism.Method overloading: Method overloading is a technique which allows you to have more than one function with the same function name but with different functionality.Method overloading can be possible on the following basis:The return type of the overloaded function.The type of the parameters passed to the function.The number of parameters passed to the function.Let's understand this through an example:#include <iostream> using namespace std; class Multiply { public: int mul(int a,int b) { return(a*b); } int mul(int a,int b,int c) { return(a*b*c); } }; int main() { Multiply multi; int res1,res2; res1=multi.mul(2,3); res2=multi.mul(2,3,4); cout<<"\n"; cout<<res1; cout<<"\n"; cout<<res2; return 0; } Output:6 24 In the above example, mul() is an overloaded function with the different number of parameters.8) Define namespace in C++.The namespace is a logical division of the code which is designed to stop the naming conflict.The namespace defines the scope where the identifiers such as variables, class, functions are declared.The main purpose of using namespace in C++ is to remove the ambiguity. Ambiquity occurs when the different task occurs with the same name.For example: if there are two functions exist with the same name such as add(). In order to prevent this ambiguity, the namespace is used. Functions are declared in different namespaces.C++ consists of a standard namespace, i.e., std which contains inbuilt classes and functions. So, by using the statement "using namespace std;" includes the namespace "std" in our program.Syntax of namespace:namespace namespace_name { //body of namespace; } Syntax of accessing the namespace variable:namespace_name::member_name; Let's understand this through an example:#include <iostream> using namespace std; namespace addition { int a=5; int b=5; int add() { return(a+b); } } int main() { int result; result=addition::add(); cout<<result; return 0; } Output:10 9) Define token in C++.A token in C++ can be a keyword, identifier, literal, constant and symbol.10) Who was the creator of C++?Bjarne Stroustrup.11) Which operations are permitted on pointers?Following are the operations that can be performed on pointers:Incrementing or decrementing a pointer: Incrementing a pointer means that we can increment the pointer by the size of a data type to which it points.There are two types of increment pointers:1. Pre-increment pointer: The pre-increment operator increments the operand by 1, and the value of the expression becomes the resulting value of the incremented. Suppose ptr is a pointer then pre-increment pointer is represented as ++ptr.Let's understand this through an example:#include <iostream> using namespace std; int main() { int a[5]={1,2,3,4,5}; int *ptr; ptr=&a[0]; cout<<"Value of *ptr is : "<<*ptr<<"\n"; cout<<"Value of *++ptr : "<<*++ptr; return 0; } Output:Value of *ptr is : 1 Value of *++ptr : 2 2. Post-increment pointer: The post-increment operator increments the operand by 1, but the value of the expression will be the value of the operand prior to the incremented value of the operand. Suppose ptr is a pointer then post-increment pointer is represented as ptr++.Let's understand this through an example:#include <iostream> using namespace std; int main() { int a[5]={1,2,3,4,5}; int *ptr; ptr=&a[0]; cout<<"Value of *ptr is : "<<*ptr<<"\n"; cout<<"Value of *ptr++ : "<<*ptr++; return 0; } Output:Value of *ptr is : 1 Value of *ptr++ : 1 Subtracting a pointer from another pointer: When two pointers pointing to the members of an array are subtracted, then the number of elements present between the two members are returned.12) Define 'std'.Std is the default namespace standard used in C++.13) Which programming language's unsatisfactory performance led to the discovery of C++?C++was discovered in order to cope with the disadvantages of C.14) How delete [] is different from delete?Delete is used to release a unit of memory, delete[] is used to release an array.15) What is the full form of STL in C++?STL stands for Standard Template Library.16) What is an object?The Object is the instance of a class. A class provides a blueprint for objects. So you can create an object from a class. The objects of a class are declared with the same sort of declaration that we declare variables of basic types.17) What are the C++ access specifiers?The access specifiers are used to define how to functions and variables can be accessed outside the class.There are three types of access specifiers:Private: Functions and variables declared as private can be accessed only within the same class, and they cannot be accessed outside the class they are declared.Public: Functions and variables declared under public can be accessed from anywhere.Protected: Functions and variables declared as protected cannot be accessed outside the class except a child class. This specifier is generally used in inheritance.18) What is Object Oriented Programming (OOP)?OOP is a methodology or paradigm that provides many concepts. The basic concepts of Object Oriented Programming are given below:Classes and Objects: Classes are used to specify the structure of the data. They define the data type. You can create any number of objects from a class. Objects are the instances of classes.Encapsulation: Encapsulation is a mechanism which binds the data and associated operations together and thus hides the data from the outside world. Encapsulation is also known as data hiding. In C++, It is achieved using the access specifiers, i.e., public, private and protected.Abstraction: Abstraction is used to hide the internal implementations and show only the necessary details to the outer world. Data abstraction is implemented using interfaces and abstract classes in C++.Some people confused about Encapsulation and abstraction, but they both are different.Inheritance: Inheritance is used to inherit the property of one class into another class. It facilitates you to define one class in term of another class.19) What is the difference between an array and a list?An Array is a collection of homogeneous elements while a list is a collection of heterogeneous elements.Array memory allocation is static and continuous while List memory allocation is dynamic and random.In Array, users don't need to keep in track of next memory allocation while In the list, the user has to keep in track of next location where memory is allocated.20) What is the difference between new() and malloc()?new() is a preprocessor while malloc() is a function.There is no need to allocate the memory while using "new" but in malloc() you have to use sizeof()."new" initializes the new memory to 0 while malloc() gives random value in the newly allotted memory location.The new() operator allocates the memory and calls the constructor for the object initialization and malloc() function allocates the memory but does not call the constructor for the object initialization.The new() operator is faster than the malloc() function as operator is faster than the function.21) What are the methods of exporting a function from a DLL?There are two ways:By using the DLL's type library.Taking a reference to the function from the DLL instance.22) Define friend function.Friend function acts as a friend of the class. It can access the private and protected members of the class. The friend function is not a member of the class, but it must be listed in the class definition. The non-member function cannot access the private data of the class. Sometimes, it is necessary for the non-member function to access the data. The friend function is a non-member function and has the ability to access the private data of the class.To make an outside function friendly to the class, we need to declare the function as a friend of the class as shown below:class sample { // data members; public: friend void abc(void); }; Following are the characteristics of a friend function:The friend function is not in the scope of the class in which it has been declared.Since it is not in the scope of the class, so it cannot be called by using the object of the class. Therefore, friend function can be invoked like a normal function.A friend function cannot access the private members directly, it has to use an object name and dot operator with each member name.Friend function uses objects as arguments.Let's understand this through an example:#include <iostream> using namespace std; class Addition { int a=5; int b=6; public: friend int add(Addition a1) { return(a1.a+a1.b); } }; int main() { int result; Addition a1; result=add(a1); cout<<result; return 0; } Output:11 23) What is a virtual function?A virtual function is used to replace the implementation provided by the base class. The replacement is always called whenever the object in question is actually of the derived class, even if the object is accessed by a base pointer rather than a derived pointer.A virtual function is a member function which is present in the base class and redefined by the derived class.When we use the same function name in both base and derived class, the function in base class is declared with a keyword virtual.When the function is made virtual, then C++ determines at run-time which function is to be called based on the type of the object pointed by the base class pointer. Thus, by making the base class pointer to point different objects, we can execute different versions of the virtual functions.Rules of a virtual function:The virtual functions should be a member of some class.The virtual function cannot be a static member.Virtual functions are called by using the object pointer.It can be a friend of another class.C++ does not contain virtual constructors but can have a virtual destructor.24) When should we use multiple inheritance?You can answer this question in three manners:NeverRarelyIf you find that the problem domain cannot be accurately modeled any other way.25) What is a destructor?A Destructor is used to delete any extra resources allocated by the object. A destructor function is called automatically once the object goes out of the scope.Rules of destructor:Destructors have the same name as class name and it is preceded by tilde.It does not contain any argument and no return type.26) What is an overflow error?It is a type of arithmetical error. It happens when the result of an arithmetical operation been greater than the actual space provided by the system.27) What is overloading?When a single object behaves in many ways is known as overloading. A single object has the same name, but it provides different versions of the same function.C++ facilitates you to specify more than one definition for a function name or an operator in the same scope. It is called function overloading and operator overloading respectively.Overloading is of two types:1. Operator overloading: Operator overloading is a compile-time polymorphism in which a standard operator is overloaded to provide a user-defined definition to it. For example, '+' operator is overloaded to perform the addition operation on data types such as int, float, etc.Operator overloading can be implemented in the following functions:Member functionNon-member functionFriend functionSyntax of Operator overloading:Return_type classname :: Operator Operator_symbol(argument_list) { // body_statements; } 2. Function overloading: Function overloading is also a type of compile-time polymorphism which can define a family of functions with the same name. The function would perform different operations based on the argument list in the function call. The function to be invoked depends on the number of arguments and the type of the arguments in the argument list.28) What is function overriding?If you inherit a class into a derived class and provide a definition for one of the base class's function again inside the derived class, then this function is called overridden function, and this mechanism is known as function overriding.29) What is virtual inheritance?Virtual inheritance facilitates you to create only one copy of each object even if the object appears more than one in the hierarchy.30) What is a constructor?A Constructor is a special method that initializes an object. Its name must be same as class name.31) What is the purpose of the "delete" operator?The "delete" operator is used to release the dynamic memory created by "new" operator.32) Explain this pointer?This pointer holds the address of the current object.33) What does Scope Resolution operator do?A scope resolution operator(::) is used to define the member function outside the class.34) What is the difference between delete and delete[]?Delete [] is used to release the array of allocated memory which was allocated using new[] whereas delete is used to release one chunk of memory which was allocated using new.35) What is a pure virtual function?The pure virtual function is a virtual function which does not contain any definition. The normal function is preceded with a keyword virtual. The pure virtual function ends with 0.Syntax of a pure virtual function:virtual void abc()=0; //pure virtual function. Let's understand this through an example:#include<iostream> using namespace std; class Base { public: virtual void show()=0; }; class Derived:public Base { public: void show() { cout<<"javaTpoint"; } }; int main() { Base* b; Derived d; b=&d; b->show(); return 0; } Output:javaTpoint 36) What is the difference between struct and class?StructuresclassA structure is a user-defined data type which contains variables of dissimilar data types.The class is a user-defined data type which contains member variables and member functions.The variables of a structure are stored in the stack memory.The variables of a class are stored in the heap memory.We cannot initialize the variables directly.We can initialize the member variables directly.If access specifier is not specified, then by default the access specifier of the variable is "public".If access specifier is not specified, then by default the access specifier of a variable is "private".The instance of a structure is a "structure variable".Declaration of a structure:struct structure_name { // body of structure; } ; Declaration of class:class class_name { // body of class; } A structure is declared by using a struct keyword.The class is declared by using a class keyword.The structure does not support the inheritance.The class supports the concept of inheritance.The type of a structure is a value type.The type of a class is a reference type.37) What is a class template?A class template is used to create a family of classes and functions. For example, we can create a template of an array class which will enable us to create an array of various types such as int, float, char, etc. Similarly, we can create a template for a function, suppose we have a function add(), then we can create multiple versions of add().The syntax of a class template:template<class T> class classname { // body of class; }; Syntax of a object of a template class:classname<type> objectname(arglist); 38) What is the difference between function overloading and operator overloading?Function overloading: Function overloading is defined as we can have more than one version of the same function. The versions of a function will have different signature means that they have a different set of parameters.Operator overloading: Operator overloading is defined as the standard operator can be redefined so that it has a different meaning when applied to the instances of a class.39) What is a virtual destructor?A virtual destructor in C++ is used in the base class so that the derived class object can also be destroyed. A virtual destructor is declared by using the ~ tilde operator and then virtual keyword before the constructor.Note: Constructor cannot be virtual, but destructor can be virtual.Let's understand this through an exampleExample without using virtual destructor#include <iostream> using namespace std; class Base { public: Base() { cout<<"Base constructor is called"<<"\n"; } ~Base() { cout<<"Base class object is destroyed"<<"\n"; } }; class Derived:public Base { public: Derived() { cout<<"Derived class constructor is called"<<"\n"; } ~Derived() { cout<<"Derived class object is destroyed"<<"\n"; } }; int main() { Base* b= new Derived; delete b; return 0; } Output:Base constructor is called Derived class constructor is called Base class object is destroyed In the above example, delete b will only call the base class destructor due to which derived class destructor remains undestroyed. This leads to the memory leak.Example with a virtual destructor#include <iostream> using namespace std; class Base { public: Base() { cout<<"Base constructor is called"<<"\n"; } virtual ~Base() { cout<<"Base class object is destroyed"<<"\n"; } }; class Derived:public Base { public: Derived() { cout<<"Derived class constructor is called"<<"\n"; } ~Derived() { cout<<"Derived class object is destroyed"<<"\n"; } }; int main() { Base* b= new Derived; delete b; return 0; } Output:Base constructor is called Derived class constructor is called Derived class object is destroyed Base class object is destroyedWhen we use he virtual destructor, then the derived class destructor is called first, and then the base class destructor is called.
More detailsPublished - Mon, 05 Dec 2022
Created by - Admin s
A list of most frequently asked Data Structure interview questions and answers are given below.1) What is Data Structure? Explain.The data structure is a way that specifies how to organize and manipulate the data. It also defines the relationship between them. Some examples of Data Structures are arrays, Linked List, Stack, Queue, etc. Data Structures are the central part of many computer science algorithms as they enable the programmers to handle the data in an efficient way2) Describe the types of Data Structures?Data Structures are mainly classified into two types:Linear Data Structure: A data structure is called linear if all of its elements are arranged in the sequential order. In linear data structures, the elements are stored in a non-hierarchical way where each item has the successors and predecessors except the first and last element.Play VideoxNon-Linear Data Structure: The Non-linear data structure does not form a sequence i.e. each item or element is connected with two or more other items in a non-linear arrangement. The data elements are not arranged in the sequential structure.3) List the area of applications of Data Structure.Data structures are applied extensively in the following areas of computer science:Compiler Design,Operating System,Database Management System,Statistical analysis package,Numerical Analysis,Graphics,Artificial Intelligence,Simulation4) What is the difference between file structure and storage structure?Difference between file structure and storage structure:The main difference between file structure and storage structure is based on memory area that is being accessed.Storage structure: It is the representation of the data structure in the computer memory.File structure: It is the representation of the storage structure in the auxiliary memory.5) List the data structures which are used in RDBMS, Network Data Modal, and Hierarchical Data Model.RDBMS uses Array data structureNetwork data model uses GraphHierarchal data model uses Trees6) Which data structure is used to perform recursion?Stack data structure is used in recursion due to its last in first out nature. Operating system maintains the stack in order to save the iteration variables at each function call7) What is a Stack?Stack is an ordered list in which, insertion and deletion can be performed only at one end that is called the top. It is a recursive data structure having pointer to its top element. The stack is sometimes called as Last-In-First-Out (LIFO) list i.e. the element which is inserted first in the stack will be deleted last from the stack.8) List the area of applications where stack data structure can be used?Expression evaluationBacktrackingMemory ManagementFunction calling and return9) What are the operations that can be performed on a stack?Push OperationsPop OperationsPeek Operations10) Write the stack overflow condition.Overflow occurs when top = Maxsize -111) What is the difference between PUSH and POP?PUSH and POP operations specify how data is stored and retrieved in a stack.PUSH: PUSH specifies that data is being "inserted" into the stack.POP: POP specifies data retrieval. It means that data is being deleted from the stack.12) Write the steps involved in the insertion and deletion of an element in the stack.Push:Increment the variable top so that it can refer to the next memory allocationCopy the item to the at the array index value equal to the topRepeat step 1 and 2 until stack overflowsPop:Store the topmost element into the an another variableDecrement the value of the topReturn the topmost element13) What is a postfix expression?An expression in which operators follow the operands is known as postfix expression. The main benefit of this form is that there is no need to group sub-expressions in parentheses or to consider operator precedence.The expression "a + b" will be represented as "ab+" in postfix notation.14)Write the postfix form of the expression: (A + B) * (C - D)AB+CD-*)15) Which notations are used in Evaluation of Arithmetic Expressions using prefix and postfix forms?Polish and Reverse Polish notations.16)What is an array?Arrays are defined as the collection of similar types of data items stored at contiguous memory locations. It is the simplest data structure in which each data element can be randomly accessed by using its index number.17) How to reference all the elements in a one-dimension array?It can be done by using an indexed loop such that the counter runs from 0 to the array size minus one. In this manner, you can reference all the elements in sequence by using the loop counter as the array subscript.18) What is a multidimensional array?The multidimensional array can be defined as the array of arrays in which, the data is stored in tabular form consists of rows and columns. 2D arrays are created to implement a relational database lookalike data structure. It provides ease of holding the bulk of data at once which can be passed to any number of functions wherever required.19) How are the elements of a 2D array are stored in the memory?There are two techniques by using which, the elements of a 2D array can be stored in the memory.Row-Major Order: In row-major ordering, all the rows of the 2D array are stored into the memory contiguously. First, the 1st row of the array is stored into the memory completely, then the 2nd row of the array is stored into the memory completely and so on till the last row.Column-Major Order: In column-major ordering, all the columns of the 2D array are stored into the memory contiguously. first, the 1st column of the array is stored into the memory completely, then the 2nd row of the array is stored into the memory completely and so on till the last column of the array.20) Calculate the address of a random element present in a 2D array, given base address as BA.Row-Major Order: If array is declared as a[m][n] where m is the number of rows while n is the number of columns, then address of an element a[i][j] of the array stored in row major order is calculated as,Address(a[i][j]) = B. A. + (i * n + j) * sizeColumn-Major Order: If array is declared as a[m][n] where m is the number of rows while n is the number of columns, then address of an element a[i][j] of the array stored in column major order is calculated asAddress(a[i][j]) = ((j*m)+i)*Size + BA.21) Define Linked List Data structure.Linked List is the collection of randomly stored data objects called nodes. In Linked List, each node is linked to its adjacent node through a pointer. A node contains two fields, i.e. Data Field and Link Field.22) Are linked lists considered linear or non-linear data structures?A linked list is considered both linear and non-linear data structure depending upon the situation.On the basis of data storage, it is considered as a non-linear data structure.On the basis of the access strategy, it is considered as a linear data-structure.23) What are the advantages of Linked List over an array?The size of a linked list can be incremented at runtime which is impossible in the case of the array.The List is not required to be contiguously present in the main memory, if the contiguous space is not available, the nodes can be stored anywhere in the memory connected through the links.The List is dynamically stored in the main memory and grows as per the program demand while the array is statically stored in the main memory, size of which must be declared at compile time.The number of elements in the linked list are limited to the available memory space while the number of elements in the array is limited to the size of an array.24) Write the syntax in C to create a node in the singly linked list.struct node { int data; struct node *next; }; struct node *head, *ptr; ptr = (struct node *)malloc(sizeof(struct node)); 25) If you are using C language to implement the heterogeneous linked list, what pointer type should be used?The heterogeneous linked list contains different data types, so it is not possible to use ordinary pointers for this. For this purpose, you have to use a generic pointer type like void pointer because the void pointer is capable of storing a pointer to any type.26) What is doubly linked list?The doubly linked list is a complex type of linked list in which a node contains a pointer to the previous as well as the next node in the sequence. In a doubly linked list, a node consists of three parts:node datapointer to the next node in sequence (next pointer)pointer to the previous node (previous pointer).27) Write the C program to insert a node in circular singly list at the beginning.#include #include void beg_insert(int); struct node { int data; struct node *next; }; struct node *head; void main () { int choice,item; do { printf("\nEnter the item which you want to insert?\n"); scanf("%d",&item); beg_insert(item); printf("\nPress 0 to insert more ?\n"); scanf("%d",&choice); }while(choice == 0); } void beg_insert(int item) { struct node *ptr = (struct node *)malloc(sizeof(struct node)); struct node *temp; if(ptr == NULL) { printf("\nOVERFLOW"); } else { ptr -> data = item; if(head == NULL) { head = ptr; ptr -> next = head; } else { temp = head; while(temp->next != head) temp = temp->next; ptr->next = head; temp -> next = ptr; head = ptr; } printf("\nNode Inserted\n"); } } 28) Define the queue data structure.A queue can be defined as an ordered list which enables insert operations to be performed at one end called REAR and delete operations to be performed at another end called FRONT.29) List some applications of queue data structure.The Applications of the queue is given as follows:Queues are widely used as waiting lists for a single shared resource like a printer, disk, CPU.Queues are used in the asynchronous transfer of data (where data is not being transferred at the same rate between two processes) for eg. pipes, file IO, sockets.Queues are used as buffers in most of the applications like MP3 media player, CD player, etc.Queues are used to maintain the playlist in media players to add and remove the songs from the play-list.Queues are used in operating systems for handling interrupts.30) What are the drawbacks of array implementation of Queue?Memory Wastage: The space of the array, which is used to store queue elements, can never be reused to store the elements of that queue because the elements can only be inserted at front end and the value of front might be so high so that, all the space before that, can never be filled.Array Size: There might be situations in which, we may need to extend the queue to insert more elements if we use an array to implement queue, It will almost be impossible to extend the array size, therefore deciding the correct array size is always a problem in array implementation of queue.31) What are the scenarios in which an element can be inserted into the circular queue?If (rear + 1)%maxsize = front, the queue is full. In that case, overflow occurs and therefore, insertion can not be performed in the queue.If rear != max - 1, the rear will be incremented to the mod(maxsize) and the new value will be inserted at the rear end of the queue.If front != 0 and rear = max - 1, it means that queue is not full therefore, set the value of rear to 0 and insert the new element there.32) What is a dequeue?Dequeue (also known as double-ended queue) can be defined as an ordered set of elements in which the insertion and deletion can be performed at both the ends, i.e. front and rear.33) What is the minimum number of queues that can be used to implement a priority queue?Two queues are needed. One queue is used to store the data elements, and another is used for storing priorities.34) Define the tree data structure.The Tree is a recursive data structure containing the set of one or more data nodes where one node is designated as the root of the tree while the remaining nodes are called as the children of the root. The nodes other than the root node are partitioned into the nonempty sets where each one of them is to be called sub-tree.35) List the types of tree.There are six types of tree given as follows.General TreeForestsBinary TreeBinary Search TreeExpression TreeTournament Tree36) What are Binary trees?A binary Tree is a special type of generic tree in which, each node can have at most two children. Binary tree is generally partitioned into three disjoint subsets, i.e. the root of the node, left sub-tree and Right binary sub-tree.37) Write the C code to perform in-order traversal on a binary tree.void in-order(struct treenode *tree) { if(tree != NULL) { in-order(tree→ left); printf("%d",tree→ root); in-order(tree→ right); } } 38) What is the maximum number of nodes in a binary tree of height k?2k+1-1 where k >= 139) Which data structure suits the most in the tree construction?Queue data structure40) Which data structure suits the most in the tree construction?Queue data structure41) Write the recursive C function to count the number of nodes present in a binary tree.int count (struct node* t) { if(t) { int l, r; l = count(t->left); r=count(t->right); return (1+l+r); } else { return 0; } } 42) Write a recursive C function to calculate the height of a binary tree.int countHeight(struct node* t) { int l,r; if(!t) return 0; if((!(t->left)) && (!(t->right))) return 0; l=countHeight(t->left); r=countHeight(t->right); return (1+((l>r)?l:r)); } 43) How can AVL Tree be useful in all the operations as compared to Binary search tree?AVL tree controls the height of the binary search tree by not letting it be skewed. The time taken for all operations in a binary search tree of height h is O(h). However, it can be extended to O(n) if the BST becomes skewed (i.e. worst case). By limiting this height to log n, AVL tree imposes an upper bound on each operation to be O(log n) where n is the number of nodes.44) State the properties of B Tree.A B tree of order m contains all the properties of an M way tree. In addition, it contains the following properties.Every node in a B-Tree contains at most m children.Every node in a B-Tree except the root node and the leaf node contain at least m/2 children.The root nodes must have at least 2 nodes.All leaf nodes must be at the same level.45) What are the differences between B tree and B+ tree?SNB TreeB+ Tree1Search keys cannot repeatedly be stored.Redundant search keys can be present.2Data can be stored in leaf nodes as well as internal nodesData can only be stored on the leaf nodes.3Searching for some data is a slower process since data can be found on internal nodes as well as on the leaf nodes.Searching is comparatively faster as data can only be found on the leaf nodes.4Deletion of internal nodes is so complicated and time-consuming.Deletion will never be a complexed process since element will always be deleted from the leaf nodes.5Leaf nodes cannot be linked together.Leaf nodes are linked together to make the search operations more efficient.46) List some applications of Tree-data structure?Applications of Tree- data structure:The manipulation of Arithmetic expression,Symbol Table construction,Syntax analysisHierarchal data model47) Define the graph data structure?A graph G can be defined as an ordered set G(V, E) where V(G) represents the set of vertices and E(G) represents the set of edges which are used to connect these vertices. A graph can be seen as a cyclic tree, where the vertices (Nodes) maintain any complex relationship among them instead of having parent-child relations.48) Differentiate among cycle, path, and circuit?Path: A Path is the sequence of adjacent vertices connected by the edges with no restrictions.Cycle: A Cycle can be defined as the closed path where the initial vertex is identical to the end vertex. Any vertex in the path can not be visited twiceCircuit: A Circuit can be defined as the closed path where the intial vertex is identical to the end vertex. Any vertex may be repeated.49) Mention the data structures which are used in graph implementation.For the graph implementation, following data structures are used.In sequential representation, Adjacency matrix is used.In Linked representation, Adjacency list is used.50) Which data structures are used in BFS and DFS algorithm?In BFS algorithm, Queue data structure is used.In DFS algorithm, Stack data structure is used.51) What are the applications of Graph data structure?The graph has the following applications:Graphs are used in circuit networks where points of connection are drawn as vertices and component wires become the edges of the graph.Graphs are used in transport networks where stations are drawn as vertices and routes become the edges of the graph.Graphs are used in maps that draw cities/states/regions as vertices and adjacency relations as edges.Graphs are used in program flow analysis where procedures or modules are treated as vertices and calls to these procedures are drawn as edges of the graph.54) In what scenario, Binary Search can be used?Binary Search algorithm is used to search an already sorted list. The algorithm follows divide and conqer approachExample:52) What are the advantages of Binary search over linear search?There are relatively less number of comparisons in binary search than that in linear search. In average case, linear search takes O(n) time to search a list of n elements while Binary search takes O(log n) time to search a list of n elements.53) What are the advantages of Selecetion Sort?It is simple and easy to implement.It can be used for small data sets.It is 60 per cent more efficient than bubble sort.55) List Some Applications of Multilinked Structures?Sparse matrix,Index generation.56) What is the difference between NULL and VOID?Null is actually a value, whereas Void is a data type identifier.A null variable simply indicates an empty value, whereas void is used to identify pointers as having no initial size.
More detailsPublished - Mon, 05 Dec 2022
Created by - Admin s
A list of top frequently asked Linux interview questions and answers are given below.1) What is Linux?Linux is a UNIX based operating system. Linus Torvalds first introduced it. It is an open source operating system that was designed to provide free and a low-cost operating system for the computer users.2) What is the difference between UNIX and Linux?UNIX was originally started as a propriety operating system for Bell Laboratories, which later release their commercial version while Linux is a free, open source and a non-propriety operating system for the mass uses.3) What is Linux Kernel?Linux Kernel is low-level system software. It is used to manage the hardware resources for the users. It provides an interface for user-level interaction.Play Videox4) Is it legal to edit Linux Kernel?Yes. You can edit Linux Kernel because it is released under General Public License (GPL) and anyone can edit it. It comes under the category of free and open source software.5) What is LILO?LILO is a boot loader for Linux. It is used to load the Linux operating system into the main memory to begin its operations.6) What is the advantage of open source?Open source facilitates you to distribute your software, including source codes freely to anyone who is interested. So, you can add features and even debug and correct errors of the source code.7) What are the basic components of Linux?Just like other operating systems, Linux has all components like kernel, shells, GUIs, system utilities and application programs.8) What is the advantage of Linux?Every aspect comes with additional features, and it provides a free downloading facility for all codes.9) Define shellIt is an interpreter in Linux.10) Name some shells that are commonly used in Linux.The most commonly used shells in Linux are bash, csh, ksh, bsh.11) Name the Linux which is specially designed by the Sun Microsystems.Solaris is the Linux of Sun Microsystems.12) Name the Linux loader.LILO is the Linux loader.13) If you have saved a file in Linux. Later you wish to rename that file, what command is designed for it?The 'mv' command is used to rename a file.14) Write about an internal command.The commands which are built in the shells are called as the internal commands.15) Define inode.Each file is given a unique name by the operating system which is called as the inode.16) If the programmer wishes to execute an instruction at the specified time. Which command is used?The 'at' command is used for the same.17) Explain process id.The operating system uniquely identifies each process by a unique id called as the process id.18) Name some Linux variants.Some of the Linux commands are:CentOSUbuntuRedhatDebianFedora19) What is Swap Space?Swap space is used to specify a space which is used by Linux to hold some concurrent running program temporarily. It is used when RAM does not have enough space to hold all programs that are executing.20) What is BASH?BASH is a short form of Bourne Again SHell. It was a replacement to the original Bourne shell, written by Steve Bourne.21) What is the basic difference between BASH and DOS?BASH commands are case sensitive while DOS commands are not case sensitive.DOS follows a convention in naming files. In DOS, 8 character file name is followed by a dot and 3 characters for the extension. BASH doesn't follow such convention.22) What is a root account?The root account is like a system administrator account. It provides you full control of the system. You can create and maintain user accounts, assign different permission for each account, etc.23) What is CLI?CLI stands for Command Line Interface. It is an interface that allows users to type declarative commands to instruct the computer to perform operations.24) What is the GUI?GUI stands for Graphical User Interface. It uses the images and the icons which are clicked by the users to communicate with the system. It is more attractive and user-friendly because of the use of the images and icons.25) Which popular office suite is available free for both Microsoft and Linux?Open Office Suite is available free for both Microsoft and Linux. You can install it on both of them.26) Suppose your company is recently switched from Microsoft to Linux and you have some MS Word document to save and work in Linux, what will you do?Install Open Office Suite on Linux. It facilitates you to work with Microsoft documents.27) What is SMTP?SMTP stands for Simple Mail Transfer Protocol. It is an internet standard for mail transmission.28) What is Samba? Why is it used?Samba service is used to connect Linux machines to Microsoft network resources by providing Microsoft SMB support.29) What are the basic commands for user management?last,chage,chsh,lsof,chown,chmod,useradd,userdel,newusers etc.30) What is the maximum length for a filename in Linux?255 characters.31) Is Linux Operating system virus free?No, There is no operating system till date that is virus free, but Linux is known to have less number of viruses.32) Which partition stores the system configuration files in Linux system?/stc partition.33) Which command is used to uncompress gzip files?gunzip command is used to uncompress gzip files.34) Why do developers use MD5 options on passwords?MD5 is an encryption method, so it is used to encrypt the passwords before saving.35) What is a virtual desktop?The virtual desktop is used as an alternative to minimizing and maximizing different windows on the current desktop. Virtual desktop facilitates you to open one or more programs on a clean slate rather than minimizing or restoring all the needed programs.36) What is the difference between soft and hard mounting points?In the soft mount, if the client fails to connect the server, it gives an error report and closes the connection whereas in the hard mount, if the client fails to access the server, the connection hangs; and once the system is up, it again accesses the server.37) Does the Alt+Ctrl+Del key combination work in Linux?Yes, it works like windows.38) What are the file permissions in Linux?There are 3 types of permissions in Linux OS that are given below:Read: User can read the file and list the directory.Write: User can write new files in the directory .Execute: User can access and run the file in a directory.39) What are the modes used in VI editor?There are 3 types of modes in vi Editor:Regular mode or command modeInsertion mode or edit modeReplacement mode or Ex-mode40) How to exit from vi editors?The following commands are used to exit from vi editors.:wq saves the current work and exits the VI.:q! exits the VI without saving current work.41) How to delete information from a file in vi?The following commands are used to delete information from vi editors.x deletes a current character.dd deletes the current line.42) How to create a new file or modify an existing file in vi?vi filename
More detailsPublished - Tue, 06 Dec 2022
Created by - Admin s
A list of top frequently asked Unix interview questions and answers are given below.1) What is Unix?UNIX is a portable operating system that is designed for efficient multitasking and multi-user functions. Since it is a portable operating system, it can run on different hardware platforms. It is written in C language. It was developed by Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna.2) List the distributions of UNIX.UNIX has many distributions including Solaris UNIX, AIX, HP UNIX and BSD and many more.3) List some features of UNIX.UNIX includes the following features:UNIX supports the multiuser system: In UNIX it is possible that many users can use the system with their separate workspace and logins i.e.it has full support for the multiuser environment.UNIX supports the multitasking environment: In UNIX many apps can run at a single instance of time this is also known as a multitasking environment.4) What are the core concepts of UNIXThe core concepts of UNIX are given below.Kernel- The kernel is also known as the heart of the operating system. Its fundamental role is to interact with the hardware and also monitor major processes like memory management, file management, and task scheduling.Shell- It is also called command prompt, it connects the user to the operating system, whatever is typed by the user is translated into the language understood by the command prompt, and then the corresponding actions are performed.Commands and Utilities- Many built-in commands help the user perform day to day activities.mv,cat,cp,and grep etc. Some of the examplesDirectories- Every bit of data is stored in files, and these files are stored in directories, these directories combine to form a tree-like structure.5) What is a UNIX shell?The UNIX shell is a program which is used as an interface between the user and the UNIX operating system. It is not a part of the kernel, but it can communicate directly with the server.6) What is filter?A filter is a program that takes input from standard inputs and performs some operation on that input to produce a result as standard output.7) What are the devices represented in UNIX?All devices in UNIX are represented by particular files that are located in /dev directory.8) Is there any method to erase all files in the current directory, along with its all sub-directories, by using only one command?Yes, you should use "rm-r*" command for this purpose.Here, the "rm" command is used for deleting files, the -r option will erase directories and subdirectories with their internal data and * is used for selecting all entries.9) What is necessary before running a shell script from the terminal?You must make the shell script executable by using the UNIX "chmod" command.10) How to terminate a shell script if statement?A shell script if statement can be terminated by using "fi."11) Write down some common shells with their indicators?sh - Bourne shellcsh - C Shellbash - Bourne Again Shelltcsh - enhanced C Shellzsh - Z Shellksh - Korn Shell12) What are the main features of Korn Shell?ArraysJob controlCommand AliasingString manipulation abilityBuilt-in integer arithmetic13) What is the difference between cat command and more command?The cat command is used to display the file contents on the terminal, whereas more command is used like a pager which displays the screen page by page If the file is large and you have to scroll off the screen before you view it.14) Which command is used to restrict incoming messages?The "mesg" command is used to restrict incoming messages.15) Which command is used to kill the last background job?The "kill $!" Command is used to kill the last background job.16) Which data structure is used to maintain the file identification?The "inode" data structure is used to maintain the file identification. Each file has a separate inode and a unique inode number.17) What a pipe?A pipe is used to join two or more commands by using a pipe "I" character. The output of the first command is propagated to the second command through the pipe.18) What are the links and symbolic links in a UNIX file system?A link is a second name for a file. Links are used to assign more than one name to a file, but cannot be used to designate a directory more than one name or link filenames on different computers.Symbolic links are the files that only contain the name of another file. The operations on the symbolic link are directed to the file pointed by it. Both the limitations of connections are eliminated in symbolic links.19) Explain system bootup in UNIX.System bootup is the first thing that takes place when the power button is pressed in UNIX. Whenever the power button is pressed, BIOS is fired up and checks if all the hardware connected to the system are working correctly, after being successful the system asks the user to provide authentication.20) How to change the password in UNIX operating system?To change the password in UNIX operating system :Type in the command passwd.You will get a screen which prompts to enter your default(current) password, type your current password.if the current password is verified, then the terminal will prompt you to enter the new password.Enter the new password twice, and your password will be updated.21) How to list directories in UNIX?Command ls can be used to list directories in command prompt. Also, we can also use a variety of ls commands like:ls -aIn Linux, hidden files start with. (dot) Symbol and they are not visible in the regular directory. The (ls -a) command will enlist the whole list of the current directory including the hidden files.ls -lIt will show the list in a long list format.ls -lhThis command will show you the file sizes in human readable format. Size of the file is tough to read when displayed regarding a byte. The (ls -lh)command will give you the data regarding Mb, Gb, Tb, etc.ls -lhSIf you want to display your files in descending order (highest at the top) according to their size, then you can use (ls -lhS) command.ls -l - -block-size=[SIZE]It is used to display the files in a specific size format. Here, in [SIZE] you can assign size according to your requirement.ls -d */It is used to display only sub directories.ls -g or ls -lGWith this, you can exclude column of group information and owner.ls -nIt is used to print group ID and owner ID instead of their names.ls --color=[Value]This command is used to print list as colored or discolored.ls -liThis command prints the index number if the file in the first column.ls -pIt is used to identify the directory easily by marking the directories with a slash (/) line sign.ls -RIt will display the content of the sub-directories also.ls -lXIt will group the files with the same extensions together in the list.ls -ltIt will sort the list by displaying a recently modified file at the top.ls ~It gives the contents of the home directory.ls ../It gives the contents of the parent directory.ls --versionIt checks the version of ls command.22) How to check the date in UNIX?To display the date in UNIX use the date command in command prompt.23) How to log out in UNIX?To log out of UNIX type the logout command in the command prompt.24) How to perform a system shutdown in UNIX?To perform system shutdown in UNIX, you can use the following commands:haltinit 0init 6power offrebootshutdown25) How many types of files are there in UNIX?There are three kinds of files in UNIX:Ordinary files: An ordinary file is the one which contains data, text or program instructions.Directories: These include both ordinary files and special files.Special Files: These are the files which provide unique access to hardware such as hard drives, CD-Rom Drives e.t.c.26) What are hidden files in UNIX?Hidden files in UNIX are the files which have a .(dot) before the file name. These files do not show up in the traditional file manager.Common examples of hidden files are:.profile.kshrc.rhosts.cshrc27) What is the difference between a single dot and double dot in UNIX?.(Single dot)-represents the current directory..(Double dot)-represents the parent directory.28) How to create files in UNIX?Creating files in UNIX is simple. The User needs to use the vi editor to create new files.Type vi filename in command prompt to create new files. We can also use the touch command to create a zero byte file.29) How to display the contents of a file?The user can use the cat command followed by the filename to display the command of a file. This command should be entered in the command prompt. The syntax of the command is shown below.$ cat filenameWhere the cat is the command to view contents of the file specified by the filename. Also if you want the line number to be displayed along with the content, you can use cat command with option -b.30) How to calculate the number of words in a file?To count the number of words in a file, Use the following command.$ wc filenameWhere wc is the command to count the number of words in the file specified by filename.31) How to create a blank file in UNIX?Blank files can be created by using the touch command, the syntax for the touch command is as follows:$ touch filename32) How to know the present working directory in UNIX?To know the present working directory, Run the following command on the terminal.$ pwd33) How to know the information about a file?To fetch the information about a file, use the following command.$ file filename34) How to change the directory in UNIX?To change the directory, you can use the cd command in the terminal window. It changes the current directory to the specified directory.$ cd directory-name35) How to move files from one directory to other in UNIX?In UNIX, mv command is used to move the file from one directory to some other directory.$ mv <file-name> <destination path>36) How to copy files from one directory to other in UNIX?In UNIX, cp command is used to copy a file from one directory to some other directory. The syntax of the cp command is given below.$ cp -r source filename destination file name.The -r is used to copy all the content of a directory including sub-directories recursively.37) How to remove files in UNIX?To remove files, you can use the rm command. The syntax of the rm command is given below.$ rm <filename>we can use -r with the rm command to delete all the sub-directories recursively.38) How to make a new directory in UNIX?To make a new directory, you can use the mkdir command.$ mkdir <directory-name>39) How to remove the directory in UNIX?To remove the directory, you can use the rmdir command. To use this command, use the following syntax.$ rmdir filename.
More detailsPublished - Tue, 06 Dec 2022
Created by - Admin s
A list of top frequently asked networking interview questions and answers are given below1) What is the network?A network is a set of devices that are connected with a physical media link. In a network, two or more nodes are connected by a physical link or two or more networks are connected by one or more nodes.A network is a collection of devices connected to each other to allow the sharing of data.Example of a network is an internet. An internet connects the millions of people across the world.2) What do you mean by network topology?Network topology specifies the layout of a computer network. It shows how devices and cables are connected to each other. The types of topologies are:Bus:Bus topology is a network topology in which all the nodes are connected to a single cable known as a central cable or bus.It acts as a shared communication medium, i.e., if any device wants to send the data to other devices, then it will send the data over the bus which in turn sends the data to all the attached devices.Bus topology is useful for a small number of devices. As if the bus is damaged then the whole network fails.Star:Play VideoxStar topology is a network topology in which all the nodes are connected to a single device known as a central device.Star topology requires more cable compared to other topologies. Therefore, it is more robust as a failure in one cable will only disconnect a specific computer connected to this cable.If the central device is damaged, then the whole network fails.Star topology is very easy to install, manage and troubleshoot.Star topology is commonly used in office and home networks.RingRing topology is a network topology in which nodes are exactly connected to two or more nodes and thus, forming a single continuous path for the transmission.It does not need any central server to control the connectivity among the nodes.If the single node is damaged, then the whole network fails.Ring topology is very rarely used as it is expensive, difficult to install and manage.Examples of Ring topology are SONET network, SDH network, etc.MeshMesh topology is a network topology in which all the nodes are individually connected to other nodes.It does not need any central switch or hub to control the connectivity among the nodes.Mesh topology is categorized into two parts:Fully connected mesh topology: In this topology, all the nodes are connected to each other.Partially connected mesh topology: In this topology, all the nodes are not connected to each other.It is a robust as a failure in one cable will only disconnect the specified computer connected to this cable.Mesh topology is rarely used as installation and configuration are difficult when connectivity gets more.Cabling cost is high as it requires bulk wiring.TreeTree topology is a combination of star and bus topology. It is also known as the expanded star topology.In tree topology, all the star networks are connected to a single bus.Ethernet protocol is used in this topology.In this, the whole network is divided into segments known as star networks which can be easily maintained. If one segment is damaged, but there is no effect on other segments.Tree topology depends on the "main bus," and if it breaks, then the whole network gets damaged.HybridA hybrid topology is a combination of different topologies to form a resulting topology.If star topology is connected with another star topology, then it remains star topology. If star topology is connected with different topology, then it becomes a Hybrid topology.It provides flexibility as it can be implemented in a different network environment.The weakness of a topology is ignored, and only strength will be taken into consideration.3) What are the advantages of Distributed Processing?A list of advantages of distributed processing:SecureSupport EncapsulationDistributed databaseFaster Problem solvingSecurity through redundancyCollaborative Processing4) What is the criteria to check the network reliability?Network reliability: Network reliability means the ability of the network to carry out the desired operation through a network such as communication through a network.Network reliability plays a significant role in the network functionality. The network monitoring systems and devices are the essential requirements for making the network reliable.The network monitoring system identifies the problems that are occurred in the network while the network devices ensure that data should reach the appropriate destination.The reliability of a network can be measured by the following factors:Downtime: The downtime is defined as the required time to recover.Failure Frequency: It is the frequency when it fails to work the way it is intended.Catastrophe: It indicates that the network has been attacked by some unexpected event such as fire, earthquake.5) Which are the different factors that affect the security of a network?There are mainly two security affecting factors:Unauthorized AccessViruses6) Which are the different factors that affect the reliability of a network?The following factors affect the reliability of a network:Frequency of failureRecovery time of a network after a failure7) Which are the different factors that affect the performance of a network?The following factors affect the performance of a network:Large number of usersTransmission medium typesHardwareSoftware8) What makes a network effective and efficient?There are mainly two criteria which make a network effective and efficient:Performance: : performance can be measured in many ways like transmit time and response time.Reliability: reliability is measured by frequency of failure.Robustness: robustness specifies the quality or condition of being strong and in good condition.Security: It specifies how to protect data from unauthorized access and viruses.9) What is bandwidth?Every signal has a limit of upper range frequency and lower range frequency. The range of limit of network between its upper and lower frequency is called bandwidth.10) What is a node and link?A network is a connection setup of two or more computers directly connected by some physical mediums like optical fiber or coaxial cable. This physical medium of connection is known as a link, and the computers that it is connected are known as nodes.11) What is a gateway? Is there any difference between a gateway and router?A node that is connected to two or more networks is commonly known as a gateway. It is also known as a router. It is used to forward messages from one network to another. Both the gateway and router regulate the traffic in the network.Differences between gateway and router:A router sends the data between two similar networks while gateway sends the data between two dissimilar networks.12) What is DNS?DNS is an acronym stands for Domain Name System.DNS was introduced by Paul Mockapetris and Jon Postel in 1983.It is a naming system for all the resources over the internet which includes physical nodes and applications. It is used to locate to resource easily over a network.DNS is an internet which maps the domain names to their associated IP addresses.Without DNS, users must know the IP address of the web page that you wanted to access.Working of DNS:If you want to visit the website of "javaTpoint", then the user will type "https://www.javatpoint.com" into the address bar of the web browser. Once the domain name is entered, then the domain name system will translate the domain name into the IP address which can be easily interpreted by the computer. Using the IP address, the computer can locate the web page requested by the user.13) What is DNS forwarder?A forwarder is used with DNS server when it receives DNS queries that cannot be resolved quickly. So it forwards those requests to external DNS servers for resolution.A DNS server which is configured as a forwarder will behave differently than the DNS server which is not configured as a forwarder.Following are the ways that the DNS server behaves when it is configured as a forwarder:When the DNS server receives the query, then it resolves the query by using a cache.If the DNS server is not able to resolve the query, then it forwards the query to another DNS server.If the forwarder is not available, then it will try to resolve the query by using root hint.14) What is NIC?NIC stands for Network Interface Card. It is a peripheral card attached to the PC to connect to a network. Every NIC has its own MAC address that identifies the PC on the network.It provides a wireless connection to a local area network.NICs were mainly used in desktop computers.15) What is the meaning of 10Base-T?It is used to specify data transfer rate. In 10Base-T, 10 specify the data transfer rate, i.e., 10Mbps. The word Base specifies the baseband as opposed to broadband. T specifies the type of the cable which is a twisted pair.16) What is NOS in computer networking?NOS stands for Network Operating System. It is specialized software which is used to provide network connectivity to a computer to make communication possible with other computers and connected devices.NOS is the software which allows the device to communicate, share files with other devices.The first network operating system was Novel NetWare released in 1983. Some other examples of NOS are Windows 2000, Windows XP, Linux, etc.17) What are the different types of networks?Networks can be divided on the basis of area of distribution. For example:PAN (Personal Area Network): Its range limit is up to 10 meters. It is created for personal use. Generally, personal devices are connected to this network. For example computers, telephones, fax, printers, etc.LAN (Local Area Network): It is used for a small geographical location like office, hospital, school, etc.HAN (House Area Network): It is actually a LAN that is used within a house and used to connect homely devices like personal computers, phones, printers, etc.CAN (Campus Area Network): It is a connection of devices within a campus area which links to other departments of the organization within the same campus.MAN (Metropolitan Area Network): It is used to connect the devices which span to large cities like metropolitan cities over a wide geographical area.WAN (Wide Area Network): It is used over a wide geographical location that may range to connect cities and countries.GAN (Global Area Network): It uses satellites to connect devices over global are.18) What is POP3?POP3 stands for Post Office Protocol version3. POP is responsible for accessing the mail service on a client machine. POP3 works on two models such as Delete mode and Keep mode.19) What do you understand by MAC address?MAC stands for Media Access Control. It is the address of the device at the Media Access Control Layer of Network Architecture. It is a unique address means no two devices can have same MAC addresses.20) What is IP address?IP address is a unique 32 bit software address of a computer in a network system.21) What is private IP address?There are three ranges of IP addresses that have been reserved for IP addresses. They are not valid for use on the internet. If you want to access internet on these private IPs, you must have to use proxy server or NAT server.22) What is public IP address?A public IP address is an address taken by the Internet Service Provider which facilitates you to communication on the internet.23) What is APIPA?APIPA is an acronym stands for Automatic Private IP Addressing. This feature is generally found in Microsoft operating system.24) What is the full form of ADS?ADS stands for Active Directory Structure.ADS is a microsoft technology used to manage the computers and other devices.ADS allows the network administrators to manage the domains, users and objects within the network.ADS consists of three main tiers:Domain: Users that use the same database will be grouped into a single domain.Tree: Multiple domains can be grouped into a single tree.Forest: Multiple trees can be grouped into a single forest.25) What is RAID?RAID is a method to provide Fault Tolerance by using multiple Hard Disc Drives.26) What is anonymous FTP?Anonymous FTP is used to grant users access to files in public servers. Users which are allowed access to data in these servers do not need to identify themselves, but instead log in as an anonymous guest.27) What is protocol?A protocol is a set of rules which is used to govern all the aspects of information communication.28) What are the main elements of a protocol?The main elements of a protocol are:Syntax: It specifies the structure or format of the data. It also specifies the order in which they are presented.Semantics: It specifies the meaning of each section of bits.Timing: Timing specifies two characteristics: When data should be sent and how fast it can be sent.29 What is the Domain Name System?There are two types of client/server programs. First is directly used by the users and the second supports application programs.The Domain Name System is the second type supporting program that is used by other programs such as to find the IP address of an e-mail recipient.30) What is link?A link is connectivity between two devices which includes the cables and protocols used in order to make communication between devices.31) How many layers are in OSI reference model?OSI reference model: OSI reference model is an ISO standard which defines a networking framework for implementing the protocols in seven layers. These seven layers can be grouped into three categories:Network layer: Layer 1, Layer 2 and layer 3 are the network layers.Transport layer: Layer 4 is a transport layer.Application layer. Layer 5, Layer 6 and Layer 7 are the application layers.There are 7 layers in the OSI reference model.1. Physical LayerIt is the lowest layer of the OSI reference model.It is used for the transmission of an unstructured raw bit stream over a physical medium.Physical layer transmits the data either in the form of electrical/optical or mechanical form.The physical layer is mainly used for the physical connection between the devices, and such physical connection can be made by using twisted-pair cable, fibre-optic or wireless transmission media.2. DataLink LayerIt is used for transferring the data from one node to another node.It receives the data from the network layer and converts the data into data frames and then attach the physical address to these frames which are sent to the physical layer.It enables the error-free transfer of data from one node to another node.Functions of Data-link layer:Frame synchronization: Data-link layer converts the data into frames, and it ensures that the destination must recognize the starting and ending of each frame.Flow control: Data-link layer controls the data flow within the network.Error control: It detects and corrects the error occurred during the transmission from source to destination.Addressing: Data-link layer attach the physical address with the data frames so that the individual machines can be easily identified.Link management: Data-link layer manages the initiation, maintenance and, termination of the link between the source and destination for the effective exchange of data.3. Network LayerNetwork layer converts the logical address into the physical address.It provides the routing concept means it determines the best route for the packet to travel from source to the destination.Functions of network layer:Routing: The network layer determines the best route from source to destination. This function is known as routing.Logical addressing: The network layer defines the addressing scheme to identify each device uniquely.Packetizing: The network layer receives the data from the upper layer and converts the data into packets. This process is known as packetizing.Internetworking: The network layer provides the logical connection between the different types of networks for forming a bigger network.Fragmentation: It is a process of dividing the packets into the fragments.4. Transport LayerIt delivers the message through the network and provides error checking so that no error occurs during the transfer of data.It provides two kinds of services:Connection-oriented transmission: In this transmission, the receiver sends the acknowledgement to the sender after the packet has been received.Connectionless transmission: In this transmission, the receiver does not send the acknowledgement to the sender.5. Session LayerThe main responsibility of the session layer is beginning, maintaining and ending the communication between the devices.Session layer also reports the error coming from the upper layers.Session layer establishes and maintains the session between the two users.6. Presentation LayerThe presentation layer is also known as a Translation layer as it translates the data from one format to another format.At the sender side, this layer translates the data format used by the application layer to the common format and at the receiver side, this layer translates the common format into a format used by the application layer.Functions of presentation layer:Character code translationData conversionData compressionData encryption7. Application LayerApplication layer enables the user to access the network.It is the topmost layer of the OSI reference model.Application layer protocols are file transfer protocol, simple mail transfer protocol, domain name system, etc.The most widely used application protocol is HTTP(Hypertext transfer protocol ). A user sends the request for the web page using HTTP.32) What is the usage of OSI physical layer?The OSI physical layer is used to convert data bits into electrical signals and vice versa. On this layer, network devices and cable types are considered and setup.33) Explain the functionality of OSI session layer?OSI session layer provides the protocols and means for two devices on the network to communicate with each other by holding a session. This layer is responsible for setting up the session, managing information exchange during the session, and tear-down process upon termination of the session.34) What is the maximum length allowed for a UTP cable?The maximum length of UTP cable is 90 to 100 meters.35) What is RIP?RIP stands for Routing Information Protocol. It is accessed by the routers to send data from one network to another.RIP is a dynamic protocol which is used to find the best route from source to the destination over a network by using the hop count algorithm.Routers use this protocol to exchange the network topology information.This protocol can be used by small or medium-sized networks.36) What do you understand by TCP/IP?TCP/IP is short for Transmission Control Protocol /Internet protocol. It is a set of protocol layers that is designed for exchanging data on different types of networks.37) What is netstat?The "netstat" is a command line utility program. It gives useful information about the current TCP/IP setting of a connection.38) What do you understand by ping command?The "ping" is a utility program that allows you to check the connectivity between the network devices. You can ping devices using its IP address or name.39) What is Sneakernet?Sneakernet is the earliest form of networking where the data is physically transported using removable media.40) Explain the peer-peer process.The processes on each machine that communicate at a given layer are called peer-peer process.41) What is a congested switch?A switch receives packets faster than the shared link. It can accommodate and stores in its memory, for an extended period of time, then the switch will eventually run out of buffer space, and some packets will have to be dropped. This state is called a congested state.42) What is multiplexing in networking?In Networking, multiplexing is the set of techniques that is used to allow the simultaneous transmission of multiple signals across a single data link.43) What are the advantages of address sharing?Address sharing provides security benefit instead of routing. That's because host PCs on the Internet can only see the public IP address of the external interface on the computer that provides address translation and not the private IP addresses on the internal network.44) What is RSA Algorithm?RSA is short for Rivest-Shamir-Adleman algorithm. It is mostly used for public key encryption.45) How many layers are in TCP/IP?There are basic 4 layers in TCP/IP:Application LayerTransport LayerInternet LayerNetwork Layer46) What is the difference between TCP/IP model and the OSI model?Following are the differences between the TCP/IP model and OSI model:TCP/IP modelOSI modelFull form of TCP is transmission control protocol.Full form of OSI is Open System Interconnection.TCP/IP has 4 layers.OSI has 7 layers.TCP/IP is more reliable than the OSI model.OSI model is less reliable as compared to the TCP/IP model.TCP/IP model uses horizontal approach.OSI model uses vertical approach.TCP/IP model uses both session and presentation layer in the application layer.OSI Reference model uses separate session and presentation layers.TCP/IP model developed the protocols first and then model.OSI model developed the model first and then protocols.In Network layer, TCP/IP model supports only connectionless communication.In the Network layer, the OSI model supports both connection-oriented and connectionless communication.TCP/IP model is a protocol dependent.OSI model is a protocol independent.47) What is the difference between domain and workgroup?WorkgroupDomainA workgroup is a peer-to-peer computer network.A domain is a Client/Server network.A Workgroup can consist of maximum 10 computers.A domain can consist up to 2000 computers.Every user can manage the resources individually on their PCs.There is one administrator to administer the domain and its resources.All the computers must be on the same local area network.The computer can be on any network or anywhere in the world.Each computer must be changed manually.Any change made to the computer will reflect the changes to all the computers.
More detailsPublished - Tue, 06 Dec 2022
Created by - Admin s
Android programming is growing day by day. The questions asked by interviewers in android is given below. A list of top android interview questions and answers:1) What is Android?Android is an open-source, Linux-based operating system used in mobiles, tablets, televisions, etc.2) Who is the founder of Android?Andy Rubin.3) Explain the Android application Architecture.Following is a list of components of Android application architecture:Play VideoxServices: Used to perform background functionalities.Intent: Used to perform the interconnection between activities and the data passing mechanism.Resource Externalization: strings and graphics.Notification: light, sound, icon, notification, dialog box and toast.Content Providers: It will share the data between applications.4) What are the code names of android?AestroBlenderCupcakeDonutEclairFroyoGingerbreadHoneycombIce Cream SandwichJelly BeanKitKatLollipopMarshmallowMore details...5) What are the advantages of Android?Open-source: It means no license, distribution and development fee.Platform-independent: It supports Windows, Mac, and Linux platforms.Supports various technologies: It supports camera, Bluetooth, wifi, speech, EDGE etc. technologies.Highly optimized Virtual Machine: Android uses a highly optimized virtual machine for mobile devices, called DVM (Dalvik Virtual Machine).6) Does android support other languages than java?Yes, an android app can be developed in C/C++ also using android NDK (Native Development Kit). It makes the performance faster. It should be used with Android SDK.7) What are the core building blocks of android?The core building blocks of Android are:ActivityViewIntentServiceContent ProviderFragment etc.More details...8) What is activity in Android?Activity is like a frame or window in java that represents GUI. It represents one screen of android.9) What are the life cycle methods of android activity?There are 7 life-cycle methods of activity. They are as follows:onCreate()onStart()onResume()onPause()onStop()onRestart()onDestroy()More details...10) What is intent?It is a kind of message or information that is passed to the components. It is used to launch an activity, display a web page, send SMS, send email, etc. There are two types of intents in android:Implicit IntentExplicit Intent11) How are view elements identified in the android program?View elements can be identified using the keyword findViewById.12) Define Android toast.An android toast provides feedback to the users about the operation being performed by them. It displays the message regarding the status of operation initiated by the user.13) Give a list of impotent folders in androidThe following folders are declared as impotent in android:AndroidManifest.xmlbuild.xmlbin/src/res/assets/14) Explain the use of 'bundle' in android?We use bundles to pass the required data to various subfolders.15) What is an application resource file?The files which can be injected for the building up of a process are called as application resource file.16) What is the use of LINUX ID in android?A unique Linux ID is assigned to each application in android. It is used for the tracking of a process.17) Can the bytecode be written in java be run on android?No18) List the various storages that are provided by Android.The various storage provided by android are:Shared PreferencesInternal StorageExternal StorageSQLite DatabasesNetwork Connection19) How are layouts placed in Android?Layouts in Android are placed as XML files.20) Where are layouts placed in Android?Layouts in Android are placed in the layout folder.21) What is the implicit intent in android?The Implicit intent is used to invoke the system components.22) What is explicit intent in android?An explicit intent is used to invoke the activity class.23) How to call another activity in android?Intent i = new Intent(getApplicationContext(), ActivityTwo.class); startActivity(i); 24) What is service in android?A service is a component that runs in the background. It is used to play music, handle network transaction, etc.More details...25) What is the name of the database used in android?SQLite: An opensource and lightweight relational database for mobile devices.More details...26) What is AAPT?AAPT is an acronym for android asset packaging tool. It handles the packaging process.27) What is a content provider?A content provider is used to share information between Android applications.28) What is fragment?The fragment is a part of Activity by which we can display multiple screens on one activity.29) What is ADB?ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator instance.30) What is NDK?NDK stands for Native Development Kit. By using NDK, you can develop a part of an app using native language such as C/C++ to boost the performance.31) What is ANR?ANR stands for Application Not Responding. It is a dialog box that appears if the application is no longer responding.32) What is the Google Android SDK?The Google Android SDK is a toolset which is used by developers to write apps on Android-enabled devices. It contains a graphical interface that emulates an Android-driven handheld environment and allows them to test and debug their codes.33) What is an APK format?APK is a short form stands for Android Packaging Key. It is a compressed key with classes, UI's, supportive assets and manifest. All files are compressed to a single file is called APK.34) Which language does Android support to develop an application?Android applications are written by using the java (Android SDK) and C/C++ (Android NDK).35) What is ADT in Android?ADT stands for Android Development Tool. It is used to develop the applications and test the applications.36) What is View Group in Android?View Group is a collection of views and other child views. It is an invisible part and the base class for layouts.37) What is the Adapter in Android?An adapter is used to create a child view to present the parent view items.38) What is nine-patch images tool in Android?We can change bitmap images into nine sections with four corners, four edges, and an axis.39) Which kernel is used in Android?Android is a customized Linux 3.6 kernel.40) What is application Widgets in Android?Application widgets are miniature application views that can be embedded in other applications and receive periodic updates.41) Which types of flags are used to run an application on Android?Following are two types of flags to run an application in Android:FLAG_ACTIVITY_NEW_TASKFLAG_ACTIVITY_CLEAR_TOP42) What is a singleton class in Android?A singleton class is a class which can create only an object that can be shared by all other classes.43) What is sleep mode in Android?In sleep mode, CPU is slept and doesn't accept any commands from android device except Radio interface layer and alarm.44) What do you mean by a drawable folder in Android?In Android, a drawable folder is compiled a visual resource that can use as a background, banners, icons, splash screen, etc.45) What is DDMS?DDMS stands for Dalvik Debug Monitor Server. It gives the wide array of debugging features:Port forwarding servicesScreen captureThread and heap informationNetwork traffic trackingLocation data spoofing46) Define Android Architecture?The Android architecture consists of 4 components:Linux KernalLibrariesAndroid FrameworkAndroid ApplicationsMore details...47) What is a portable wi-fi hotspot?The portable wi-fi hotspot is used to share internet connection to other wireless devices.48) Name the dialog box which is supported by Android?Alert DialogProgress DialogDate Picker DialogTime picker Dialog49) Name some exceptions in Android?Inflate ExceptionSurface.OutOfResourceExceptionSurfaceHolder.BadSurfaceTypeExceptionWindowManager.BadTokenException50) What are the basic tools used to develop an Android app?JDKEclipse+ADT pluginSDK Tools
More detailsPublished - Tue, 06 Dec 2022
Created by - Admin s
There is given Cloud Computing interview questions and answers that has been asked in many companies. Let's see the list of top Cloud Computing interview questions.1) What is cloud computing?Cloud computing is an internet based new age computer technology. It is the next stage technology that uses the clouds to provide the services whenever and wherever the user need it.It provides a method to access several servers world wide.2) What are the benefits of cloud computing?The main benefits of cloud computing are:Data backup and storage of data.Powerful server capabilities.Incremented productivity.Very cost effective and time saving.Software as Service known as SaaS.3) What is a cloud?A cloud is a combination of networks ,hardware, services, storage, and interfaces that helps in delivering computing as a service. It has three users :Play VideoxEnd usersBusiness management userscloud service provider4) What are the different data types used in cloud computing?There are different data types in cloud computing like emails, contracts, images , blogs etc. As we know that data is increasing day by day so it is needed to new data types to store these new data. For an example, if you want to store video then you need a new data type.5) Which are the different layers that define cloud architecture?Following are the different layers that are used by cloud architecture:CLC or Cloud ControllerWalrusCluster ControllerSC or Storage ControllerNC or Node Controller6) Which platforms are used for large scale cloud computing?The following platforms are used for large scale cloud computing:Apache HadoopMapReduce7) What are the different layers in cloud computing? Explain working of them.There are 3 layers in the hierarchy of cloud computing.Infrastructure as a service (IaaS):It provides cloud infrastructure in terms of hardware as like memory, processor, speed etc.Platform as a service (PaaS):It provides cloud application platform for the developer.Software as a service (SaaS)::It provides the cloud applications to users directly without installing anything on the system. These applications remains on cloud.8) What do you mean by software as a service?Software As a Service (SaaS) is an important layer of cloud computing. It provides cloud applications like Google is doing. It facilitate users to save their document on the cloud and create as well.9) What is the platform as a service?It is also a layer in cloud architecture. This model is built on the infrastructure model and provide resources like computers, storage and network. It is responsible to provide complete virtualization of the infrastructure layer, make it look like a single server and invisible for outside world.10) What is on-demand functionality? How is it provided in cloud computing?Cloud computing provides a on-demand access to the virtualized IT resources. It can be used by the subscriber. It uses shared pool to provide configurable resources. Shared pool contains networks, servers, storage, applications and services.11) What are the platforms used for large scale cloud computing?Apache Hadoop and MapReduce are the platforms use for large scale cloud computing.12) What are the different models for deployment in cloud computing?These are the different deployment model in cloud computing:Private cloudPublic cloudHybrid cloudCommunity cloud13) What is private cloud?Private clouds are used to keep the strategic operations and other reasons secure. It is a complete platform which is fully functional and can be owned, operated and restricted to only an organization or an industry. Now a day, most of the organizations have moved to private clouds due to security concerns. Virtual private cloud is being used that operate by a hosting company.14) What is public cloud?The public clouds are open to the people for use and deployment. For example: Google and Amazon etc. The public clouds focus on a few layers like cloud application, infrastructure providing and providing platform markets.15) What are Hybrid clouds?Hybrid clouds are the combination of public clouds and private clouds. It is preferred over both the clouds because it applies most robust approach to implement cloud architecture. It includes the functionalities and features of both the worlds. It allows organizations to create their own cloud and allow them to give the control over to someone else as well.16) What is the difference between cloud computing and mobile computing?Mobile computing and cloud computing are slightly same in concept. Mobile computing uses the concept of cloud computing . Cloud computing provides users the data which they required while in mobile computing, applications run on the remote server and gives user the access for storage and manage.17) What is the difference between scalability and elasticity?Scalability is a characteristic of cloud computing which is used to handle the increasing workload by increasing in proportion amount of resource capacity. By the use of scalability, the architecture provides on demand resources if the requirement is being raised by the traffic. Whereas, Elasticity is a characteristic which provides the concept of commissioning and decommissioning of large amount of resource capacity dynamically. It is measured by the speed by which the resources are coming on demand and the usage of the resources.18) What are the security benefits of cloud computing?Cloud computing authorizes the application service, so it is used in identity management.It provides permissions to the users so that they can control the access of another user who is entering into the cloud environment.19) What is the usage of utility computing?Utility computing is a plug-in managed by an organization which decides what type of services has to be deployed from the cloud. It facilitates users to pay only for what they use.20) What is "EUCALYPTUS" in cloud computing? Why is it used?It is an acronym stands for Elastic Utility Computing Architecture For Linking Your Program To Useful Systems. It is an open source software infrastructure in cloud computing and used to implement clusters in cloud computing platform. It creates public, private and hybrid cloud. It facilitate a user to create his own data center into a private cloud and use its functionalities to many other organizations.21) Explain System integrators in cloud computing.System integrator provides a strategy of a complicated process used to design a cloud platform. It creates more accurate hybrid and private cloud network because integrator have all the knowledge about the data center creation.22) What are the open source cloud computing platform databases?MongoDB, CouchDB, LucidDB are the example of open source cloud computing platform database.23) Give some example of large cloud provider and databases?Google bigtableAmazon simpleDBCloud based SQL24) What is the difference between cloud and traditional datacenters?The cost of the traditional datacenter is higher than cloud because in traditional databases, there is overheating problems and some software and hardware issue.25) What are the different in Software as a Service (SaaS)?Simple Multi-tenancy:In this mode, Every user has independent resources and are uniquely different from other users. This is an efficient mode.Fine grain multi-tenancy:: In this mode, the resources can be shared by many users but the functionality remains the same.26) Why API's is used in cloud services?API's (Application Programming Interfaces) is used in cloud platform because:It provide an alternative way that you don't need to write the fully fledged program.It makes communication between one or more applications.It creates applications and link the cloud services with other systems.27) What are the advantages of cloud services?Following are the main advantages of cloud services:Cost saving: It helps in the utilization of investment in the corporate sector. So, it is cost saving.Scalable and Robust: It helps in the developing scalable and robust applications. Previously, the scaling took months, but now, scaling takes less time.Time saving: It helps in saving time in terms of deployment and maintenance.28) What are the different datacenters in cloud computing?Containerized datacenterLow density datacenter29) What do you mean by CaaS?CaaS is a terminology used in telecom industry as Communication As a Service. CaaS offers the enterprise user features such as desktop call control, unified messaging and desktop faxing.30) What do you mean by VPN? What does it contain?VPN stands for Virtual Private Network. VPN is a private cloud that manage the security of the data during the communication in the cloud environment. With VPN, you can make a public network as private network.31) What are the basic clouds in cloud computing?There are three basic clouds in cloud computing:Professional cloudPersonal cloudPerformance cloud32) What are the most essential things that must be followed before going for cloud computing platform?ComplianceLoss of dataData storageBusiness continuityUptimeData integrity in cloud computing33) Which services are provided by Window azure operating system?There are three core services provided by Window azure operating system:ComputeStorageManagement34) What is the usage of virtualization platform in implementing cloud?The main usage of virtualization platform in implementing cloud is:It is used to manage the service level policies.Cloud Operating System.Virtualization platforms help to keep the backend level and user level concepts different from each other.35) We source cloud computing platform databases?Following are the open source cloud computing platform databases:MongoDBCouchDBLucidDB36) What are some large cloud providers and databases?Following are the mostly used large cloud providers and databases:Google bigtableAmazon simpleDBCloud based SQL37) How would you secure data for transport in cloud?This is the most obvious question accurued in mind that if the cloud data is secure; To ensure that, check that there is no data leak with the encryption key implemented with the data you sending while the data moves from point A to point B in cloud.
More detailsPublished - Tue, 06 Dec 2022
Created by - Admin s
There is given Hadoop interview questions and answers that have been asked in many companies. Let's see the list of top Hadoop interview questions.1) What is Hadoop?Hadoop is a distributed computing platform. It is written in Java. It consists of the features like Google File System and MapReduce.2) What platform and Java version are required to run Hadoop?Java 1.6.x or higher versions are good for Hadoop, preferably from Sun. Linux and Windows are the supported operating system for Hadoop, but BSD, Mac OS/X, and Solaris are more famous for working.3) What kind of Hardware is best for Hadoop?Hadoop can run on a dual processor/ dual core machines with 4-8 GB RAM using ECC memory. It depends on the workflow needs.4) What are the most common input formats defined in Hadoop?These are the most common input formats defined in Hadoop:TextInputFormatKeyValueInputFormatSequenceFileInputFormatTextInputFormat is a by default input format.5) How do you categorize a big data?The big data can be categorized using the following features:VolumeVelocityVariety6) Explain the use of .mecia class?For the floating of media objects from one side to another, we use this class.7) Give the use of the bootstrap panel.We use panels in bootstrap from the boxing of DOM components.8) What is the purpose of button groups?Button groups are used for the placement of more than one buttons in the same line.9) Name the various types of lists supported by Bootstrap.Ordered listUnordered listDefinition list10) Which command is used for the retrieval of the status of daemons running the Hadoop cluster?The 'jps' command is used for the retrieval of the status of daemons running the Hadoop cluster.11) What is InputSplit in Hadoop? Explain.When a Hadoop job runs, it splits input files into chunks and assigns each split to a mapper for processing. It is called the InputSplit.12) What is TextInputFormat?In TextInputFormat, each line in the text file is a record. Value is the content of the line while Key is the byte offset of the line. For instance, Key: longWritable, Value: text13) What is the SequenceFileInputFormat in Hadoop?In Hadoop, SequenceFileInputFormat is used to read files in sequence. It is a specific compressed binary file format which passes data between the output of one MapReduce job to the input of some other MapReduce job.14) How many InputSplits is made by a Hadoop Framework?Hadoop makes 5 splits as follows:One split for 64K filesTwo splits for 65MB files, andTwo splits for 127MB files15) What is the use of RecordReader in Hadoop?InputSplit is assigned with a work but doesn't know how to access it. The record holder class is totally responsible for loading the data from its source and convert it into keys pair suitable for reading by the Mapper. The RecordReader's instance can be defined by the Input Format.16) What is JobTracker in Hadoop?JobTracker is a service within Hadoop which runs MapReduce jobs on the cluster.17) What is WebDAV in Hadoop?WebDAV is a set of extension to HTTP which is used to support editing and uploading files. On most operating system WebDAV shares can be mounted as filesystems, so it is possible to access HDFS as a standard filesystem by exposing HDFS over WebDAV.18) What is Sqoop in Hadoop?Sqoop is a tool used to transfer data between the Relational Database Management System (RDBMS) and Hadoop HDFS. By using Sqoop, you can transfer data from RDBMS like MySQL or Oracle into HDFS as well as exporting data from HDFS file to RDBMS.19) What are the functionalities of JobTracker?These are the main tasks of JobTracker:To accept jobs from the client.To communicate with the NameNode to determine the location of the data.To locate TaskTracker Nodes with available slots.To submit the work to the chosen TaskTracker node and monitors the progress of each task.20) Define TaskTracker.TaskTracker is a node in the cluster that accepts tasks like MapReduce and Shuffle operations from a JobTracker.21) What is Map/Reduce job in Hadoop?Map/Reduce job is a programming paradigm which is used to allow massive scalability across the thousands of server.MapReduce refers to two different and distinct tasks that Hadoop performs. In the first step maps jobs which takes the set of data and converts it into another set of data and in the second step, Reduce job. It takes the output from the map as input and compresses those data tuples into the smaller set of tuples.22) What is "map" and what is "reducer" in Hadoop?Map: In Hadoop, a map is a phase in HDFS query solving. A map reads data from an input location and outputs a key-value pair according to the input type.Reducer: In Hadoop, a reducer collects the output generated by the mapper, processes it, and creates a final output of its own.23) What is shuffling in MapReduce?Shuffling is a process which is used to perform the sorting and transfer the map outputs to the reducer as input.24) What is NameNode in Hadoop?NameNode is a node, where Hadoop stores all the file location information in HDFS (Hadoop Distributed File System). We can say that NameNode is the centerpiece of an HDFS file system which is responsible for keeping the record of all the files in the file system, and tracks the file data across the cluster or multiple machines.25) What is heartbeat in HDFS?Heartbeat is a signal which is used between a data node and name node, and between task tracker and job tracker. If the name node or job tracker doesn't respond to the signal then it is considered that there is some issue with data node or task tracker.26) How is indexing done in HDFS?There is a very unique way of indexing in Hadoop. Once the data is stored as per the block size, the HDFS will keep on storing the last part of the data which specifies the location of the next part of the data.27) What happens when a data node fails?If a data node fails the job tracker and name node will detect the failure. After that, all tasks are re-scheduled on the failed node and then name node will replicate the user data to another node.28) What is Hadoop Streaming?Hadoop streaming is a utility which allows you to create and run map/reduce job. It is a generic API that allows programs written in any languages to be used as Hadoop mapper.29) What is a combiner in Hadoop?A Combiner is a mini-reduce process which operates only on data generated by a Mapper. When Mapper emits the data, combiner receives it as input and sends the output to a reducer.30) What are the Hadoop's three configuration files?Following are the three configuration files in Hadoop:core-site.xmlmapred-site.xmlhdfs-site.xml31) What are the network requirements for using Hadoop?Following are the network requirement for using Hadoop:Password-less SSH connection.Secure Shell (SSH) for launching server processes.32) What do you know by storage and compute node?Storage node: Storage Node is the machine or computer where your file system resides to store the processing data.Compute Node: Compute Node is a machine or computer where your actual business logic will be executed.33) Is it necessary to know Java to learn Hadoop?If you have a background in any programming language like C, C++, PHP, Python, Java, etc. It may be really helpful, but if you are nil in java, it is necessary to learn Java and also get the basic knowledge of SQL.34) How to debug Hadoop code?There are many ways to debug Hadoop codes but the most popular methods are:By using Counters.By web interface provided by the Hadoop framework.35) Is it possible to provide multiple inputs to Hadoop? If yes, explain.Yes, It is possible. The input format class provides methods to insert multiple directories as input to a Hadoop job.36) What is the relation between job and task in Hadoop?In Hadoop, A job is divided into multiple small parts known as the task.37) What is the difference between Input Split and HDFS Block?The Logical division of data is called Input Split and physical division of data is called HDFS Block.38) What is the difference between RDBMS and Hadoop?RDBMSHadoopRDBMS is a relational database management system.Hadoop is a node based flat structure.RDBMS is used for OLTP processing.Hadoop is used for analytical and for big data processing.In RDBMS, the database cluster uses the same data files stored in shared storage.In Hadoop, the storage data can be stored independently in each processing node.In RDBMS, preprocessing of data is required before storing it.In Hadoop, you don't need to preprocess data before storing it.39) What is the difference between HDFS and NAS?HDFS data blocks are distributed across local drives of all machines in a cluster whereas, NAS data is stored on dedicated hardware.40) What is the difference between Hadoop and other data processing tools?Hadoop facilitates you to increase or decrease the number of mappers without worrying about the volume of data to be processed.41) What is distributed cache in Hadoop?Distributed cache is a facility provided by MapReduce Framework. It is provided to cache files (text, archives etc.) at the time of execution of the job. The Framework copies the necessary files to the slave node before the execution of any task at that node.36) What commands are used to see all jobs running in the Hadoop cluster and kill a job in LINUX?Hadoop job - listHadoop job - kill jobID42) What is the functionality of JobTracker in Hadoop? How many instances of a JobTracker run on Hadoop cluster?JobTracker is a giant service which is used to submit and track MapReduce jobs in Hadoop. Only one JobTracker process runs on any Hadoop cluster. JobTracker runs it within its own JVM process.Functionalities of JobTracker in Hadoop:When client application submits jobs to the JobTracker, the JobTracker talks to the NameNode to find the location of the data.It locates TaskTracker nodes with available slots for data.It assigns the work to the chosen TaskTracker nodes.The TaskTracker nodes are responsible to notify the JobTracker when a task fails and then JobTracker decides what to do then. It may resubmit the task on another node or it may mark that task to avoid.43) How JobTracker assign tasks to the TaskTracker?The TaskTracker periodically sends heartbeat messages to the JobTracker to assure that it is alive. This messages also inform the JobTracker about the number of available slots. This return message updates JobTracker to know about where to schedule task.44) Is it necessary to write jobs for Hadoop in the Java language?No, There are many ways to deal with non-java codes. HadoopStreaming allows any shell command to be used as a map or reduce function.45) Which data storage components are used by Hadoop?HBase data storage component is used by Hadoop.
More detailsPublished - Tue, 06 Dec 2022
Fri, 16 Jun 2023
Fri, 16 Jun 2023
Fri, 16 Jun 2023
Write a public review