Page 1 :
TCS QUESTIONS WITH ANSWERS:, Note to the students:, •, •, •, •, , This document contains the short answers for given questions, Please do not stick on to the same notations used., Can replace technical words equivalent to the given answer without changing the, entire meaning, Please do not use same variable name, table name, etc.… given in the answers., , 1. Program on even odd, 2. #include <stdio.h>, 3. int main() {, 4. int num;, 5. printf("Enter an integer: ");, 6. scanf("%d", &num);, 7., 8. // True if num is perfectly divisible by 2, 9. if(num % 2 == 0), 10., printf("%d is even.", num);, 11. else, 12., printf("%d is odd.", num);, 13., 14. return 0;, 15. }, 3. Explain transpose of a matrix., The transpose of a matrix is a new matrix that is obtained by exchanging the rows and, columns., #include <stdio.h>, int main() {, int a[10][10], transpose[10][10], r, c, i, j;, printf("Enter rows and columns: ");, scanf("%d %d", &r, &c);, // Assigning elements to the matrix, printf("\nEnter matrix elements:\n");, for (i = 0; i < r; ++i), for (j = 0; j < c; ++j) {, printf("Enter element a%d%d: ", i + 1, j + 1);, scanf("%d", &a[i][j]);, }, SVC – 11/11/2020
Page 2 :
// Displaying the matrix a[][], printf("\nEntered matrix: \n");, for (i = 0; i < r; ++i), for (j = 0; j < c; ++j) {, printf("%d ", a[i][j]);, if (j == c - 1), printf("\n");, }, // Finding the transpose of matrix a, for (i = 0; i < r; ++i), for (j = 0; j < c; ++j) {, transpose[j][i] = a[i][j];, }, // Displaying the transpose of matrix a, printf("\nTranspose of the matrix:\n");, for (i = 0; i < c; ++i), for (j = 0; j < r; ++j) {, printf("%d ", transpose[i][j]);, if (j == r - 1), printf("\n");, }, return 0;, }, 4. What is GPS and GPRS., GPS stands for Global Positioning System. whereas GPRS stands for General Packet Radio, Service. GPS is used for the satellite based navigation systems, mapping as well as GIS etc., Whereas GPRS is used for video calling, Email accessing, multimedia messaging etc., 5. Working of GPS and GPRS., GPRS is classed as being a packet switched network whereby radio resources are used only, when users are actually sending or receiving data. Rather than dedicating a radio channel to a, mobile data user for a fixed period of time, the available radio resource can be concurrently, shared between several users., GPS : GPS is a system of 30+ navigation satellites circling Earth. ... A GPS receiver in your, phone listens for these signals. Once the receiver calculates its distance from four or, more GPS satellites, it can figure out where you are. Earth is surrounded by navigation, satellites., 6. What is TCP/IP?, SVC – 11/11/2020
Page 3 :
TCP/IP is the underlying communication language of the Internet. In base, terms, TCP/IP allows one computer to talk to another computer via the Internet through, compiling packets of data and sending them to right location., TCP/IP, or the Transmission Control Protocol/Internet Protocol, is a suite of communication, protocols used to interconnect network devices on the internet. TCP/IP can also be used as a, communications protocol in a private computer network (an intranet or an extranet)., 7. What are keywords in C?, Keywords are predefined, reserved words used in programming that have special meanings to, the compiler. Keywords are part of the syntax and they cannot be used as an identifier. For, example:, int,float,double,return,if, else., 8. Program to reverse a string., Using strrev:, #include <stdio.h>, #include <string.h>, int main(), {, char s[100];, printf("Enter a string to reverse\n");, gets(s);, strrev(s);, printf("Reverse of the string: %s\n", s);, return 0;, }, , without strrev:, #include <stdio.h>, int main(), {, char s[1000], r[1000];, int begin, end, count = 0;, printf("Input a string\n");, gets(s);, // Calculating string length, , SVC – 11/11/2020
Page 4 :
while (s[count] != '\0'), count++;, end = count - 1;, for (begin = 0; begin < count; begin++) {, r[begin] = s[end];, end--;, }, r[begin] = '\0';, printf("%s\n", r);, return 0;, }, , 9. C program to sort the elements of an array in ascending order, #include <stdio.h>, , int main(), {, //Initialize array, int arr[] = {5, 2, 8, 7, 1};, int temp = 0;, , //Calculate length of array arr, int length = sizeof(arr)/sizeof(arr[0]);, , //Displaying elements of original array, printf("Elements of original array: \n");, for (int i = 0; i < length; i++) {, printf("%d ", arr[i]);, }, , //Sort the array in ascending order, SVC – 11/11/2020
Page 5 :
for (int i = 0; i < length; i++) {, for (int j = i+1; j < length; j++) {, if(arr[i] > arr[j]) {, temp = arr[i];, arr[i] = arr[j];, arr[j] = temp;, }, }, }, , printf("\n");, , //Displaying elements of array after sorting, printf("Elements of array sorted in ascending order: \n");, for (int i = 0; i < length; i++) {, printf("%d ", arr[i]);, }, return 0;, }, 10. What is Big Data., , Big data is data that contains greater variety arriving in increasing volumes and with everhigher velocity. This is known as the three Vs., Put simply, big data is larger, more complex data sets, especially from new data sources., These data sets are so voluminous that traditional data processing software just can’t manage, them. But these massive volumes of data can be used to address business problems you, wouldn’t have been able to tackle before., , SVC – 11/11/2020, , Volume, , The amount of data, , Velocity, , Velocity is the fast rate at which data is received
Page 6 :
Variety, , Variety refers to the many types of data that are available., , 11. What is Hadoop?, The Apache Hadoop software library is a framework that allows for the distributed, processing of large data sets across clusters of computers using simple programming models., It is designed to scale up from single servers to thousands of machines, each offering local, computation and storage. Rather than rely on hardware to deliver high-availability, the library, itself is designed to detect and handle failures at the application layer, so delivering a highlyavailable service on top of a cluster of computers, each of which may be prone to failures., 12. Print disc name,file and folder name in C., #include <stdio.h>, #include <dirent.h>, , int main(void), {, struct dirent *de; // Pointer for directory entry, , // opendir() returns a pointer of DIR type., DIR *dr = opendir(".");, , if (dr == NULL) // opendir returns NULL if couldn't open directory, {, printf("Could not open current directory" );, return 0;, }, while ((de = readdir(dr)) != NULL), printf("%s\n", de->d_name);, , closedir(dr);, return 0;, }, 13. Prime number program in C., , SVC – 11/11/2020
Page 7 :
#include <stdio.h>, int main() {, int n, i, flag = 0;, printf("Enter a positive integer: ");, scanf("%d", &n);, for (i = 2; i <= n / 2; ++i) {, // condition for non-prime, if (n % i == 0) {, flag = 1;, break;, }, }, if (n == 1) {, printf("1 is neither prime nor composite.");, }, else {, if (flag == 0), printf("%d is a prime number.", n);, else, printf("%d is not a prime number.", n);, }, return 0;, }, , c program to print prime numbers in a given range:, #include <stdio.h>, #include <stdlib.h>, , void main(), {, int num1, num2, i, j, flag, temp, count = 0;, , printf("Enter the value of num1 and num2 \n");, , SVC – 11/11/2020
Page 9 :
}, , 14. How to count the number of 0s and 1s in a string without using a counter, To find the count of 0s in the binary representation of N, find the one’s complement of N and, find the count of set bits., // C program for the above approach, #include <math.h>, #include <stdio.h>, , // Function to find 1s complement, int onesComplement(int n), {, // Find number of bits in the, // given integer, int N = floor(log2(n)) + 1;, , // XOR the given integer with, // pow(2, N) - 1, return ((1 << N) - 1) ^ n;, }, , // Function to implement count of, // set bits using Brian Kernighan’s, // Algorithm, int countSetBits(int n), {, // Initialise count, int count = 0;, , // Iterate untill n is 0, , SVC – 11/11/2020
Page 10 :
while (n) {, n &= (n - 1);, count++;, }, , // Return the final count, return count;, }, , // Function to count the number of 0s, // and 1s in binary representation of N, void count1s0s(int N), {, // Initialise the count variables, int count0, count1;, , // Function call to find the number, // of set bits in N, count1 = countSetBits(N);, , // Function call to find 1s complement, N = onesComplement(N);, , // Function call to find the number, // of set bits in 1s complement of N, count0 = countSetBits(N);, , // Print the count, printf("Count of 0s in N is %d\n", count0);, printf("Count of 1s in N is %d\n", count1);, , SVC – 11/11/2020
Page 11 :
}, , // Driver Code, int main(), {, // Given Number, int N = 5;, , // Function Call, count1s0s(N);, return 0;, }, 15. Difference between DBMS and RDBMS., , 16.How to handle exceptions in PL/SQL., An exception is an error condition during a program execution. PL/SQL supports, programmers to catch such conditions using EXCEPTION block in the program and an, appropriate action is taken against the error condition. There are two types of exceptions −, •, , System-defined exceptions, , SVC – 11/11/2020
Page 12 :
•, , User-defined exceptions, , 17.Pointers in C/C++., , Pointers are symbolic representation of addresses. They enable programs to simulate, call-by-reference as well as to create and manipulate dynamic data structures. It’s, general declaration in C/C++ has the format:, Syntax:, datatype *var_name;, int *ptr;, , //ptr can point to an address which holds int data, , 18.Current trends in IT., Can explain few listed below which are familiar with an example., AI, Artificial intelligence holds significant potential for businesses. While we have yet to achieve, the full spectrum of capabilities frequently at the center of futuristic cinema, AI is poised as a, tool of choice for businesses and solution providers. As is often seen with social media, AI,, combined with machine learning, can be a powerful combination. Businesses can use AI to, achieve cost-saving benefits, streamline workflows, enable more efficient communications,, improve customer satisfaction, and provide insight into purchasing behavior., Additionally, machine learning can analyze large datasets and provide scaled insight. We are, currently just scratching the surface of how machine learning and artificial intelligence can, work together to enable businesses., IoT, As the world becomes more and more digitized, informed business is the key to success and, internet of things provides greater clarity into consumer behavior. The Internet of Things is, increasingly offering business opportunities in the form of data collection and analysis., , 3D Printing, The business applications for 3D printing are endless. The ability to customize a product, according to personalized specifications will allow businesses to provide nearly limitless, possibilities. In recent years, providing this kind of customization required either significant, reprogramming or manual intervention. With 3D printing, personalization is now one more, task that can be automated. 3D printing also enables the use of various materials that offer, cost-saving and environmentally sustainable benefits., 5G, The speeds accomplished with 5G greatly outpace those seen with previous networks. 5G, offers the supporting foundation that businesses can leverage to embrace emerging, technologies. When unencumbered by latency issues, businesses can provide greater, capabilities and service. Reaching consumer bases via mobile devices and smartphones will, soar to new heights as the IT infrastructure for 5G expands and becomes more pervasive., SVC – 11/11/2020
Page 13 :
19. Cloud Computing., the practice of using a network of remote servers hosted on the internet to store, manage, and, process data, rather than a local server or a personal computer., Examples:, Cloud computing underpins a vast number of services. That includes consumer services like, Gmail or the cloud back-up of the photos on your smartphone, though to the services which, allow large enterprises to host all their data and run all of their applications in the cloud., 20. Would you stay with one Technicalnology or you will be happy if Technicalnologies, keep changing ., Explain that you are ready to take up new technology and ready to upgrade. Since technology, is adaptive to change and so you are., 21.How Internet works?, The information used to get packets to their destinations are contained in routing tables kept, by each router connected to the Internet. Routers are packet switches. A router is usually, connected between networks to route packets between them. Each router knows about it's, sub-networks and which IP addresses they use., 22. What is a switch?, Switches facilitate the sharing of resources by connecting together all the devices, including, computers, printers, and servers, in a small business network. Thanks to the switch, these, connected devices can share information and talk to each other, regardless of where they are, in a building or on a campus. Building a small business network is not possible without, switches to tie devices together., 23.What is a router?, Just as a switch connects multiple devices to create a network, a router connects multiple, switches, and their respective networks, to form an even larger network. These networks may, be in a single location or across multiple locations. When building a small business network,, you will need one or more routers. In addition to connecting multiple networks together, the, router also allows networked devices and multiple users to access the Internet., 24.What is network topology?, Network topology is the arrangement of the elements (links, nodes, etc.) of a communication, network. ... A wide variety of physical topologies have been used in LANs, including ring,, bus, mesh and star., 25.Difference between cat and echo command in linux., cat is for listing contents of any file. echo is for listing value of some variable., 26.normalization in DBMS., SVC – 11/11/2020
Page 14 :
Normalization is a process of organizing the data in database to avoid data redundancy,, insertion anomaly, update anomaly & deletion anomaly., , 27.Primary key and unique key., Primary Key is a column that is used to uniquely identify each tuple of the table. It is used to, add integrity constraints to the table. Only one primary key is allowed to be used in a table., Unique key is a constraint that is used to uniquely identify a tuple in a table. Unique key, constraints can accept only one NULL value for column., , 28.What are joins?, A JOIN clause is used to combine rows from two or more tables, based on a related column, between them., , 29. Indexes in databases., Indexing is a way to optimize the performance of a database by minimizing the number of, disk accesses required when a query is processed. It is a data structure technique which is, used to quickly locate and access the data in a database., , 30.Types of indexing in DBMS., Indexing is defined based on its indexing attributes. Indexing can be of the following types −, •, , Primary Index − Primary index is defined on an ordered data file. The data file is, ordered on a key field. The key field is generally the primary key of the relation., , •, , Secondary Index − Secondary index may be generated from a field which is a, candidate key and has a unique value in every record, or a non-key with duplicate, values., , •, , Clustering Index − Clustering index is defined on an ordered data file. The data file, is ordered on a non-key field., , Ordered Indexing is of two types −, •, , Dense Index, , •, , Sparse Index, , 31.Types of joins., , SVC – 11/11/2020
Page 15 :
•, , (INNER) JOIN: Returns records that have matching values in both tables, , •, , LEFT (OUTER) JOIN: Returns all records from the left table, and the matched, records from the right table, , •, , RIGHT (OUTER) JOIN: Returns all records from the right table, and the, matched records from the left table, , •, , FULL (OUTER) JOIN: Returns all records when there is a match in either left, or right table, , 32.Program to display Fibonacci series., #include <stdio.h>, int main() {, int i, n, t1 = 0, t2 = 1, nextTerm;, printf("Enter the number of terms: ");, scanf("%d", &n);, printf("Fibonacci Series: ");, for (i = 1; i <= n; ++i) {, printf("%d, ", t1);, nextTerm = t1 + t2;, t1 = t2;, t2 = nextTerm;, }, return 0;, , SVC – 11/11/2020
Page 16 :
}, , 33. Latest version of C compiler., The latest version of GCC is 9.2., , 34.What is firewall?, A firewall is a network security device that monitors incoming and outgoing network traffic, and permits or blocks data packets based on a set of security rules. Its purpose is to establish, a barrier between your internal network and incoming traffic from external sources (such as, the internet) in order to block malicious traffic like viruses and hackers., , 35.Structures in C., A structure is a user defined data type in C/C++. A structure creates a data type that can be, used to group items of possibly different types into a single type., , Syntax/eg:, struct address, {, char name[50];, char street[100];, char city[50];, char state[20];, int pin;, };, , 36.What is internet ?, The Internet (or internet) is the global system of interconnected computer networks that uses, the Internet protocol suite (TCP/IP) to communicate between networks and devices., The internet is a global network of computers that works much like the postal system, only, at sub-second speeds. Just as the postal service enables people to send one another envelopes, containing messages, the internet enables computers to send one another small packets of, digital data., , 37.Program for decimal to hexadecimal., , 1. #include <stdio.h>, 2., , SVC – 11/11/2020
Page 17 :
3. int main(), 4. {, 5., long decimalnum, quotient, remainder;, 6., int i, j = 0;, 7., char hexadecimalnum[100];, 8., 9., printf("Enter decimal number: ");, 10., scanf("%ld", &decimalnum);, 11., 12., quotient = decimalnum;, 13., 14., while (quotient != 0), 15., {, 16., remainder = quotient % 16;, 17., if (remainder < 10), 18., hexadecimalnum[j++] = 48 + remainder;, 19., else, 20., hexadecimalnum[j++] = 55 + remainder;, 21., quotient = quotient / 16;, 22., }, 23. }, 24., 25., // display integer into character, 26., for (i = j; i >= 0; i--), 27., printf("%c", hexadecimalnum[i]);, 28., return 0;, 29. }, , 38.What is Data structure?, In computer science, a data structure is a data organization, management, and storage, format that enables efficient access and modification. More precisely, a data structure is a, collection of data values, the relationships among them, and the functions or operations that, can be applied to the data., , 39.What is an array?, An array is a data structure that contains a group of elements. Typically these elements are, all of the same data type, such as an integer or string. Arrays are commonly used in, computer programs to organize data so that a related set of values can be easily sorted or, searched., , 40. Types of linked list., Following are the various types of linked list., •, , Simple Linked List − Item navigation is forward only., , •, , Doubly Linked List − Items can be navigated forward and backward., , SVC – 11/11/2020
Page 18 :
•, , Circular Linked List − Last item contains link of the first element as next and the, first element has a link to the last element as previous., , 41.Software development lifecycle., Software Development Life Cycle (SDLC) is a process used by the software industry to, design, develop and test high quality softwares. The SDLC aims to produce a high-quality, software that meets or exceeds customer expectations, reaches completion within times and, cost estimates., , 42.Different types of data structures., 1. Linear: arrays, lists, 2. Tree: binary, heaps, space partitioning etc., 3. Hash: distributed hash table, hash tree etc., 4. Graphs: decision, directed, acyclic etc., 43.What is IT IS., Information technology and infrastructure., , SVC – 11/11/2020
Page 20 :
ENDS, , CODE SEGMENT, ASSUME DS:DATA CS:CODE, START:, MOV AX,DATA, MOV DS,AX, , MOV AL,NUM1, ADD AL,NUM2, , MOV RESULT,AL, , MOV AH,4CH, INT 21H, ENDS, END START, , 48. What is ITES., ITES is Information Technology Enabled Services., , 49.Static variables in C., Static variables are initialized only once. The compiler persists with the variable till the end, of the program. Static variables can be defined inside or outside the function. They are local, to the block., , 50. Copy constructor., The copy constructor is a constructor which creates an object by initializing it with an object, of the same class, which has been created previously. The copy constructor is used to −, Initialize one object from another of the same type. Copy an object to pass it as an argument, to a function., , SVC – 11/11/2020
Page 21 :
51.Virtual functions in C++., A virtual function is a member function which is declared within a base class and is redefined(Overriden) by a derived class. When you refer to a derived class object using a, pointer or a reference to the base class, you can call a virtual function for that object and, execute the derived class’s version of the function., •, , Virtual functions ensure that the correct function is called for an object, regardless of, the type of reference (or pointer) used for function call., , •, , They are mainly used to achieve Runtime polymorphism, , •, , Functions are declared with a virtual keyword in base class., , •, , The resolving of function call is done at Run-time., , 52.Multiple inheritance., Multiple Inheritance is a feature of C++ where a class can inherit from more than one classes., , 53.What is dynamic binding?, C++ provides facility to specify that the compiler should match function calls with the, correct definition at the run time; this is called dynamic binding or late binding or runtime binding. Dynamic binding is achieved using virtual functions. Base class pointer points, to derived class object., , 54.What is virtual table?, “A virtual method table (VMT) is a mechanism used in a programming language to support, dynamic dispatch.”, , 55.Difference between C,CPP,Java, , SVC – 11/11/2020
Page 22 :
56.Unix commands., •, •, , •, , mkdir dirname --- make a new directory, cd dirname --- change directory. You basically 'go' to another directory, and, you will see the files in that directory when you do 'ls'. You always start out, in your 'home directory', and you can get back there by typing 'cd' without, arguments. 'cd ..' will get you one level up from your current position. You, don't have to walk along step by step - you can make big leaps or avoid, walking around by specifying pathnames., pwd --- tells you where you currently are., , ls --- lists your files, ls -l --- lists your files in 'long format', which contains lots of useful information, e.g. the, exact size of the file, who owns the file and who has the right to look at it, and when it was, last modified., ls -a --- lists all files, including the ones whose filenames begin in a dot, which you do not, always want to see., , 57.Collections framework in java., The Collection in Java is a framework that provides an architecture to store, and manipulate the group of objects., Java Collections can achieve all the operations that you perform on a data, such as searching, sorting, insertion, manipulation, and deletion., Java Collection means a single unit of objects. Java Collection framework, provides many interfaces (Set, List, Queue, Deque) and classes (ArrayList,, Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet)., SVC – 11/11/2020
Page 23 :
58.Grep unix command., , grep filter searches a file for a particular pattern of characters, and displays all lines, that contain that pattern. The pattern that is searched in the file is referred to as the, regular expression (grep stands for globally search for regular expression and print, out)., Syntax:, grep [options] pattern [files], Options Description, -c : This prints only a count of the lines that match a pattern, -h : Display the matched lines, but do not display the filenames., -i : Ignores, case for matching, -l : Displays list of a filenames only., -n : Display the matched lines and their line numbers., -v : This prints out all the lines that do not matches the, pattern, -e exp : Specifies expression with this option. Can use multiple, times., -f file : Takes patterns from file, one per line., -E : Treats pattern as an extended regular expression (ERE), -w : Match whole word, -o : Print only the matched parts of a matching line,, with each such part on a separate output line., 59. C++ Program to Reverse a String without strrev., , #include <iostream.h>, int main(), {, char str[] = "Reverseme";, char reverse[50];, int i=-1;, int j=0;, /* Count the length, until it each at the end of string. */, while(str[++i]!='\0');, while(i>=0), SVC – 11/11/2020
Page 24 :
reverse[j++]=str[--i];, reverse[j]='\0';, cout<<"Reverse of a string is"<< reverse;, return 0;, }, , 60.NS lookup., , The NsLookup tool allows you to query DNS servers for resource records., , 61.Types of IP address., , There are four different types of IP addresses: public, private, static, and dynamic., , 62.Difference between DBMS,RDBMS,ORDBMS., , The main difference between RDBMS and ORDBMS is that RDBMS is a DBMS based on, the relational model while ORDBMS is a DBMS based on the relational model and objectoriented database model. Most enterprise applications use a DBMS to store and manage data, efficiently. One common DBMS is RDBMS which stores data in tables., , 63.Java interface and class., , SVC – 11/11/2020
Page 26 :
65.Primary key and foreign key., , SVC – 11/11/2020
Page 27 :
66.ACID properties., , 67.Polymorphism with example., The word polymorphism means having many forms. In simple words, we can, define polymorphism as the ability of a message to be displayed in more than one form. Real, life example of polymorphism: A person at the same time can have different characteristic., , For instance, let’s consider a class Animal and let Cat be a subclass of Animal. So, any, cat IS animal. Here, Cat satisfies the IS-A relationship for its own type as well as its super, class Animal., , 68.C program to read elements with and without using pointers., Using pointers:, #include <stdio.h>, #define MAX_SIZE 100 // Maximum array size, SVC – 11/11/2020
Page 28 :
int main(), {, int arr[MAX_SIZE];, int N, i;, int * ptr = arr;, , // Pointer to arr[0], , printf("Enter size of array: ");, scanf("%d", &N);, printf("Enter elements in array:\n");, for (i = 0; i < N; i++), {, scanf("%d", ptr);, // Move pointer to next array element, ptr++;, }, // Make sure that pointer again points back to first array element, ptr = arr;, printf("Array elements: ");, for (i = 0; i < N; i++), {, // Print value pointed by the pointer, printf("%d, ", *ptr);, // Move pointer to next array element, ptr++;, }, return 0;, }, , Without pointers:, , #include <stdio.h>, void main(), {, int arr[10];, int i;, printf("\n\nRead and Print elements of an array:\n");, printf("----------------------------------------\n");, printf("Input 10 elements in the array :\n");, SVC – 11/11/2020
Page 29 :
for(i=0; i<10; i++), {, printf("element - %d : ",i);, scanf("%d", &arr[i]);, }, printf("\nElements in array are: ");, for(i=0; i<10; i++), {, printf("%d ", arr[i]);, }, printf("\n");, }, 69.Operator overloading., , In C++, we can make operators to work for user defined classes. This means C++, has the ability to provide the operators with a special meaning for a data type, this, ability is known as operator overloading., For example, we can overload an operator ‘+’ in a class like String so that we can, concatenate two strings by just using +., Other example classes where arithmetic operators may be overloaded are Complex, Number, Fractional Number, Big Integer, etc., A simple and complete example, #include<iostream>, using namespace std;, , class Complex {, private:, int real, imag;, public:, Complex(int r = 0, int i =0), , {real = r;, , imag = i;}, , // This is automatically called when '+' is used with, // between two Complex objects, Complex operator + (Complex const &obj) {, Complex res;, res.real = real + obj.real;, res.imag = imag + obj.imag;, return res;, }, void print() { cout << real << " + i" << imag << endl; }, };, int main(), {, Complex c1(10, 5), c2(2, 4);, Complex c3 = c1 + c2; // An example call to "operator+", c3.print();, }, , SVC – 11/11/2020
Page 30 :
70.Properties of binary tree., A binary tree is a finite set of nodes that is either empty or consist a root node and two, disjoint binary trees called the left subtree and the right subtree. In other words, a binary, tree is a non-linear data structure in which each node has maximum of two child nodes., The tree connections can be called as branches., 71.What to do to increase speed of access of a database?, •, •, •, , Using primary keys to all the tables, Split the databases, Adding secondary indexes, , 72.Why Oracle?, •, , Scalability and Performance: Features like Real Application Clustering and, Portability make an Oracle database scalable according to the usage. ..., , •, , Availability: Real-time applications require high data availability., , 73.What is hadoop mapreduce?, MapReduce is a processing technique and a program model for distributed computing based, on java. The MapReduce algorithm contains two important tasks, namely Map and Reduce., Map takes a set of data and converts it into another set of data, where individual elements are, broken down into tuples (key/value pairs). Secondly, reduce task, which takes the output, from a map as an input and combines those data tuples into a smaller set of tuples. As the, sequence of the name MapReduce implies, the reduce task is always performed after the map, job., , 74.Features of OOP., Inheritance, Inheritance can be defined as the process where one (parent/super) class acquires the, properties (methods and fields) of another (child/sub). With the use of inheritance, the, information is made manageable in a hierarchical order., Polymorphism, Polymorphism is the ability of an object to perform different actions (or, exhibit different, behaviors) based on the context., Abstraction, Abstraction is a process of hiding the implementation details from the user, only the, functionality will be provided to the user. In other words, the user will have the information, on what the object does instead of how it does it., In Java, abstraction is achieved using Abstract classes and interfaces., Encapsulation, Encapsulation in Java is a mechanism for wrapping the data (variables) and code acting on, the data (methods) together as a single unit. In encapsulation, the variables of a class will, SVC – 11/11/2020
Page 31 :
be hidden from other classes and can be accessed only through the methods of their current, class. Therefore, it is also known as data hiding. To achieve encapsulation in Java −, 1. Declare the variables of a class as private., 2. Provide public setter and getter methods to modify and view the variables values., 75.Explain structs., A struct (short for structure) is a data type available in C programming languages, such as C,, C++, and C#. It is a user-defined data type that can store multiple related items. ..., Since structs group the data into a contiguous block of memory, only a single pointer is, needed to access all the data of a specific article., , 76.What is J2EE?, Short for Java 2 Platform Enterprise Edition. J2EE is a platform-independent, Java-centric, environment from Sun for developing, building and deploying Web-based enterprise, applications online. ... It relies on Java Server Pages and servlet code to create HTML or, other formatted data for the client., , 77.What are servlets and JSP?, A servlet is a Java class which is used to extend the capabilities of servers that host, applications accessed by means of a request-response model. Servlets are mainly used to, extend the applications hosted by webs servers, however, they can respond to other types of, requests too. For such applications, HTTP-specific servlet classes are defined by Java Servlet, technology., A JSP is a text document which contains two types of text: static data and dynamic data. The, static data can be expressed in any text-based format (like HTML, XML, SVG and WML),, and the dynamic content can be expressed by JSP elements., , 78.Explain heapsort., https://www.programiz.com/dsa/heap-sort, , 79.What is b tree and AVL tree., An AVL tree is a self-balancing binary search tree, balanced to maintain O(log n) height., , SVC – 11/11/2020
Page 32 :
A B-tree is a balanced tree, but it is not a binary tree. Nodes have more children, which, increases per-node search time but decreases the number of nodes the search needs to visit., This makes them good for disk-based trees., , 80.What is Javascript?, JavaScript is the Programming Language for the Web., JavaScript can update and change both HTML and CSS., JavaScript can calculate, manipulate and validate data., , 81.How to change MAC address to IP/PC address?, arp -s <IP address> <MAC address>, ping <IP address>-l 479, , 82.Types of topology., There are five types of topology in computer networks:, •, •, •, •, •, , Mesh Topology., Star Topology., Bus Topology., Ring Topology., Hybrid Topology., , 83.Create tables for voting system., , SVC – 11/11/2020
Page 33 :
84.Explain Joins with example/inner and outer joins., https://www.w3schools.com/sql/sql_join.asp, , 85.Use case diagram for login., , 86.Features of CPP., •, •, •, •, •, •, •, •, , Object Oriented., Simple., Platform Dependent., Mid-level programming language., Structured programming language., Rich Library., Memory Management., Powerful & Fast., , SVC – 11/11/2020
Page 34 :
1. What is Preprocessor in C?, Answer:, The C preprocessor is a macro processor that is used automatically by the C compiler to, transform your program before actual compilation. It is called a macro processor because, it allows you to define macros, which are brief abbreviations for longer constructs, conditional compilation., 2. What is Linking in C?, Answer:, Linking is the process of collecting and combining various pieces of code and data into, a file that can be loaded (copied) into memory and executed., Linking refers to the creation of a single executable file from multiple object files., 3. Test cases for pen?, Answer:, The grip of the pen: Verify if you are able to hold the pen comfortably., Writing: Verify if you are able to write smoothly., Verify that the pen is not making any sound while writing., Verify the ink flow. It should not overflow nor get a break either., Verify the quality of the material used for the pen., Verify if the company or pen name is visible clearly., Verify if the pen color or text written on the pen is not getting removed easily., Verify, whether the width of the line drawn by the pen is as per the expectations or not., Verify the ink color, it should be consistent from the start till the end., 4. Binary tree for a given number?, Answer:, Step 1 - Create a newNode with given value and set its left and right to NULL., Step 2 - Check whether tree is Empty., Step 3 - If the tree is Empty, then set root to newNode., Step 4 - If the tree is Not Empty, then check whether the value of newNode is smaller, or larger than the node (here it is root node)., Steps 5:Insert the elements to the left and right of the root. Samep process will continue, till it encounters last element., 5. What is binary tree?, Answer:, , SVC – 11/11/2020
Page 35 :
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. left subtree which is also a binary tree., 6. Which sort algorithm is best?, Answer:, Quick sort:The time complexity of Quicksort is O(n log n) in the best case, O(n log n), in the average case, and O(n^2) in the worst case. But because it has the best, performance in the average case for most inputs, Quicksort is generally considered the, “fastest” sorting algorithm., 7. what is software model?, Answer:, Software models are ways of expressing a software design. Usually some sort of, abstract language or pictures are used to express the software design. For objectoriented software, an object modeling language such as UML is used to develop and, express the software design., 8. What is SDLC model?(software development life cycle)?, Answer:, SDLC is a process followed for a software project, within a software organization. It, consists of a detailed plan describing how to develop, maintain, replace and alter or, enhance specific software. The life cycle defines a methodology for improving the, quality of software and the overall development process., 9. What is the difference between DBMS and RDBMS?, DBMS, , RDBMS, , DBMS applications store data as, file., , RDBMS applications store data in a tabular form., , In DBMS, data is generally stored, in either a hierarchical form or a, navigational form., , In RDBMS, the tables have an identifier called primary, key and the data values are stored in the form of tables., , Normalization is not present in, DBMS., , Normalization is present in RDBMS., , DBMS does not apply, security with regards to, manipulation., , RDBMS defines the integrity constraint for the, purpose of ACID (Atomocity, Consistency, Isolation and, Durability) property., , SVC – 11/11/2020, , any, data
Page 36 :
DBMS uses file system to store, data, so there will be no relation, between the tables., , in RDBMS, data values are stored in the form of tables,, so a relationship between these data values will be, stored in the form of a table as well., , DBMS has to provide some, uniform methods to access the, stored information., , RDBMS system supports a tabular structure of the data, and a relationship between them to access the stored, information., , 10.What is arrays in C++?, Answer:, Array is a collection of elements of similar datatype., 1.Single dimensional array:type arrayName [ arraySize ];, 2. Multidimensional array: type name[size1][size2]...[sizeN];, 10.What is DBMS composite key, DDL/DML and dual table?, Composite key:, In database design, a composite key is a candidate key that consists of two or more attributes, (table columns) that together uniquely identify an entity occurrence (table row). A compound, key is a composite key for which each attribute that makes up the key is a simple (foreign) key, in its own right., DDL and DML:, DDL stands for Data Definition Language. DML stands for Data Manipulation, Language. DDL statements are used to create database, schema, constraints, users, tables, etc. DML statement is used to insert, update or delete the records., Dual table:, DUAL is a table automatically created by Oracle Database along with the data, dictionary. DUAL is in the schema of the user SYS but is accessible by the name DUAL to all, users. It has one column, DUMMY , defined to be VARCHAR2(1) , and contains one row with, a value X ., 11.Difference between mysql and oracle?, Answer:, MySQL: MySQL is an open-source relational database management system (RDBMS)., Oracle: Oracle is a multi-model database with a single, integrated back-end. This means that it, can support multiple data models like document, graph, relational, and key-value within the, database., 12. What are the latest trends in computer?, Answer:, •, , Artificial Intelligence (AI), SVC – 11/11/2020
Page 37 :
•, , Machine Learning., , •, , Robotic Process Automation or RPA., , •, , Edge Computing., , •, , Virtual Reality and Augmented Reality., , •, , Cybersecurity., 13.What is cloud computing?, Answer:, Cloud computing is the on-demand availability of computer system resources, especially data, storage (cloud storage) and computing power, without direct active management by the user., The term is generally used to describe data centers available to many users over the Internet., 14.Program for String reverse?, Program:, #include<stdio.h>, #include <string.h>, int main(), {, char s[100];, printf("Enter string to reverse\n");, gets(s);, strrev(s);, printf("Reverse of the string: %s\n", s);, return 0;, }, 15. What is C language?, The C programming language is a computer programming language that was developed to do, system programming for the operating system UNIX and is an imperative programming, language. ... It is a procedural language, which means that people can write their programs as, a series of step-by-step instructions., 16.Which book you refer for C and author of C?, C: The complete reference by Herbert Schildt, This book is currently one of the bestsellers amongst the book for programming, languages. It has been recently published for the fourth edition and is upgraded with context, about the latest versions of C, namely the ANSI C or ISO standard for C., Author of C programming language is Dennis Ritchie., SVC – 11/11/2020
Page 38 :
17.Write a program to print drives, folders, files in computer system?, C Program to list all files and sub-directories in a directory:, #include <stdio.h>, #include <dirent.h>, int main(void), {, structdirent *de; // Pointer for directory entry, // opendir() returns a pointer of DIR type., DIR *dr = opendir(".");, if (dr == NULL) // opendir returns NULL if couldn't open directory, {, printf("Could not open current directory" );, return 0;, }, while ((de = readdir(dr)) != NULL), printf("%s\n", de->d_name);, closedir(dr);, return 0;, }, , 18.What is big data?, Big data is larger, more complex data sets, especially from new data sources. These data sets, are so voluminous that traditional data processing software just can’t manage them. But these, massive volumes of data can be used to address business problems you wouldn’t have been, able to tackle before., 19.Write a java program whether the string is palindrome or not?, importjava.util.Scanner;, classChkPalindrome, {, public static void main(String args[]), {, String str, rev = "";, Scanner sc = new Scanner(System.in);, System.out.println("Enter a string:");, str = sc.nextLine();, SVC – 11/11/2020
Page 39 :
int length = str.length();, for ( int i = length - 1; i >= 0; i-- ), rev = rev + str.charAt(i);, if (str.equals(rev)), System.out.println(str+" is a palindrome");, else, System.out.println(str+" is not a palindrome");, }, }, , 20.What is Inheritance and abstraction?, Inheritance:, Acquiring the properties of one class to another class is nothing but inheritance., Abstraction:Hiding the implementation details to the user and showing only the functionality., 21. What is data structure?, Data structure is a data organization, management, and storage format that enables efficient, access and modification. More precisely, a data structure is a collection of data values, the, relationships among them, and the functions or operations that can be applied to the data., 22.Write a code to implement DLL &perform operations on it?, Double linked list:, 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. Therefore, in a doubly linked list, a node, consists of three parts: node data, pointer to the next node in sequence (next pointer), pointer, to the previous node (previous pointer)., Program to perform all operations on DLL:, #include<stdio.h>, #include<stdlib.h>, struct node, {, struct node *prev;, struct node *next;, int data;, };, struct node *head;, void insertion_beginning();, void insertion_last();, SVC – 11/11/2020
Page 46 :
The backend usually consists of three parts: a server, an application, and a database. If you, book a flight or buy concert tickets, you usually open a website and interact with the frontend., Once you've entered that information, the application stores it in a database that was created, on a server., 24.What is merge sort?, In Merge sort, we divide the array recursively in two halves, until each sub-array contains a, single element, and then we merge the sub-array in a way that it results into, a sorted array. merge() function merges two sorted sub-arrays into one., 25.What is ACID property?, ACID is an acronym for four interdependent properties: Atomicity, Consistency, Isolation, and, Durability. Much of the architecture of any modern relational database is founded on, these properties. Understanding the ACID properties of a transaction is a prerequisite for, understanding many facets of SQL Server., 26.Explain OOPs concept?, OOPs concepts:, Inheritance, When one object acquires all the properties and behaviors of a parent object, it is known as, inheritance. It provides code reusability. It is used to achieve runtime polymorphism., Polymorphism, If one task is performed in different ways, it is known as polymorphism. For example: to, convince the customer differently, to draw something, for example, shape, triangle, rectangle,, etc., Abstraction, Hiding internal details and showing functionality is known as abstraction. For example phone, call, we don't know the internal processing., Encapsulation, Binding (or wrapping) code and data together into a single unit are known as encapsulation., For example, a capsule, it is wrapped with different medicines., 27. What is function overloading?, If a class has multiple methods having same name but different in parameters, it is known, as function Overloading., There are two ways to overload the method in java, 1. By changing number of arguments, SVC – 11/11/2020
Page 47 :
2. By changing the data type, 28. What is normalization?, Normalization is a systematic approach of decomposing tables to eliminate data, redundancy(repetition) and undesirable characteristics like Insertion, Update and Deletion, Anomalies. It is a multi-step process that puts data into tabular form, removing duplicated data, from the relation tables., 29.What is server and different types of servers?, In computing, a server is a piece of computer hardware or software (computer program) that, provides functionality for other programs or devices, called "clients"., Typical servers are database servers, file servers, mail servers, print servers, web servers,, game servers, and application servers., 30.Which dbms tools are in use?, The Best Database Management Software Tools, •, , SolarWinds Database Performance Analyzer (FREE TRIAL), , •, , RazorSQL., , •, , Microsoft SQL Server Management Studio., , •, , MySQL Workbench., , •, , TeamDesk., , •, , TablePlus., , •, , Sequel Pro, , •, , phpMyAdmin., , 31. Difference between mysql and nosql?:, MySQL is a relational database that is based on tabular design, whereas NoSQL is non-relational in nature with its document-based design., MySQL is being used with a standard query language called SQL, whereas NoSQL like databases misses a standard query language., 32.What is Dictionary search algorithm?, It is a kind of dictionary-matching algorithm that locates elements of a finite set of strings (the, "dictionary") within an input text., 33.What is Paging?, Paging is a memory management scheme by which a computer stores and retrieves data from, secondary storage for use in main memory., 34.Differences between c,C++,java, SVC – 11/11/2020
Page 48 :
Metrics, Programming, Paradigm, Origin, , C, , C++, Object-Oriented, Procedural language, Programming (OOP), Based on assembly, Based on C language, language, Dennis Ritchie in BjarneStroustrup, in, 1972, 1979, , Java, Pure Object Oriented, Oriented, Based on C and C++, , James Gosling in, 1991, Interpreted language, Translator, Compiler only, Compiler only, (Compiler, +, interpreter), Platform, Platform Dependency Platform Dependent Platform Dependent, Independent, Executed by JVM, Code execution, Direct, Direct, (Java, Virtual, Machine), Approach, Top-down approach Bottom-up approach, Bottom-up approach, File generation, .exe files, .exe files, .class files, Pre-processor, Support header files Supported, (#header, Use, Packages, directives, (#include, #define) #define), (import), Support, 32, keywords, Supports 63 keywords 50 defined keywords, keywords, Datatypes(union,, Supported, Supported, Not supported, structure), Supported, except, Inheritance, No inheritance, Supported, Multiple inheritance, Support, Function Operator, Overloading, No overloading, overloading, overloading is not, (Polymorphism), supported, Pointers, Supported, Supported, Not supported, Allocation, Use malloc, calloc Use new, delete, Garbage collector, Exception Handling, Not supported, Supported, Supported, Templates, Not supported, Supported, Not supported, Developer, , 35. What is pointer?, A pointer is a variable whose value is the address of another variable, i.e., direct address of, the memory location. Like any variable or constant, you must declare a pointer before using it, to store any variable address., , SVC – 11/11/2020
Page 49 :
36. How to create a table in html?, The <table> tag defines an HTML table., Each table row is defined with a <tr> tag. Each table header is defined with a <th> tag. Each, table data/cell is defined with a <td> tag., By default, the text in <th> elements are bold and centered., By default, the text in <td> elements are regular and left-aligned., 37.What is copy constructor in java?, The copy constructor is a constructor which creates an object by initializing it with an object, of the same class, which has been created previously., We can copy the values of one object into another by using copy constructor., 38. Static variable in C?, Static variables have a property of preserving their value even after they are out of their, scope!Hence, static variables preserve their previous value in their previous scope and are not, initialized again in the new scope. A static int variable remains in memory while the program is, running. A normal or auto variable is destroyed when a function call where the variable was, declared is over., 39. What is SQL query?, SQL stands for Structured Query Language. A query language is a kind of programming, language that's designed to facilitate retrieving specific information from databases, and that's, exactly what SQL does. To put it simply, SQL is the language of databases., 40. What is function overriding?, If subclass (child class) has the same method as declared in the parent class, it is known, as method overriding in Java., In other words, If a subclass provides the specific implementation of the method that has been, declared by one of its parent class, it is known as method overriding., 41. What is Pass by value and pass by reference?, Call by value:, o, , In call by value method, the value of the actual parameters is copied into the formal, parameters. In other words, we can say that the value of the variable is used in the, function call in the call by value method., , o, , In call by value method, we cannot modify the value of the actual parameter by the, formal parameter., , SVC – 11/11/2020
Page 50 :
Call by reference:, o, , In call by reference, the address of the variable is passed into the function call as the, actual parameter., , o, , The value of the actual parameters can be modified by changing the formal parameters, since the address of the actual parameters is passed., , o, , In call by reference, the memory allocation is similar for both formal parameters and, actual parameters. All the operations in the function are performed on the value stored, at the address of the actual parameters, and the modified value gets stored at the same, address., , 42. SQL CREATE TABLE,DELETE AND DROP:, SQL CREATE TABLE:, CREATE TABLE Persons (, PersonIDint,, LastNamevarchar(255),, FirstNamevarchar(255),, Address varchar(255),, City varchar(255), );, SQL DELETE:, The DELETE command is used to delete existing records in a table., DELETE FROM Customers WHERE CustomerName='hello';, SQL DROP:, The DROP COLUMN command is used to delete a column in an existing table., ALTER TABLE Customers, DROP COLUMN ContactName;, 43. What is virtual function in C++?, A virtual function is a member function that you expect to be redefined in derived classes., When you refer to a derived class object using a pointer or a reference to the base class, you, can call a virtual function for that object and execute the derived class's version of, the function., 44. What is heap sort and quick sort?, Heap Sort:, Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is, similar to selection sort where we first find the maximum element and place the maximum, element at the end. We repeat the same process for the remaining elements., Quick sort:, SVC – 11/11/2020
Page 51 :
QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the, given array around the picked pivot. There are many different versions of quickSort that pick, pivot in different ways., 1. Always pick first element as pivot., 2. Always pick last element as pivot (implemented below), 3. Pick a random element as pivot., 4. Pick median as pivot., 45.What is polymorphism?, Polymorphism in Java is a concept by which we can perform a single action in different ways., 46.What is the difference between java and oracle?, Oracle Database is a relational database that you can use to store, use, and modify data., The Java Database Connectivity (JDBC) standard is used by Java applications to access and, manipulate data in relational databases., 47.How to rename a file in UNIX?, Unix does not have a command specifically for renaming files. Instead, the mv command is, used both to change the name of a file and to move a file into a different directory., 48. What is v-model?, The V-model is an SDLC model where execution of processes happens in a sequential manner, in a V-shape. It is also known as Verification and Validation model.This means that for every, single phase in the development cycle, there is a directly associated testing phase., 49.what is the structure of link list?, A linked list is a linear data structure where each element is a separate object. Each element, (we will call it a node) of a list is comprising of two items - the data and a reference to the next, node. The last node has a reference to null. The entry point into a linked list is called the head, of the list., 50. what is primary key and unique key?, Primary Key is a column that is used to uniquely identify each tuple of the table. It is used to, add integrity constraints to the table. Only one primary key is allowed to be used in a table., Unique key is a constraint that is used to uniquely identify a tuple in a table., 51.Types of testing?, Types of Functional Testing:, •, , Unit Testing., , •, , Component Testing., , •, , Smoke Testing., , •, , Integration Testing., , •, , Regression Testing., , •, , Sanity Testing., SVC – 11/11/2020
Page 52 :
•, , System Testing., , •, , User Acceptance Testing., 52. What is B+ Tree?, B+ Tree is an extension of B Tree which allows efficient insertion, deletion and search, operations., In B Tree, Keys and records both can be stored in the internal as well as leaf nodes. Whereas,, in B+ tree, records (data) can only be stored on the leaf nodes while internal nodes can only, store the key values., The leaf nodes of a B+ tree are linked together in the form of a singly linked lists to make the, search queries more efficient., B+ Tree are used to store the large amount of data which can not be stored in the main memory., Due to the fact that, size of main memory is always limited, the internal nodes (keys to access, records) of the B+ tree are stored in the main memory whereas, leaf nodes are stored in the, secondary memory., 53.what is tunneling?, In computer networks, a tunneling protocol is a communications protocol that allows for the, movement of data from one network to another. It involves allowing private network, communications to be sent across a public network (such as the Internet) through a process, called encapsulation., 54. Difference between Firewall and Proxy Server?, , 1. Firewall :, Firewall is software program that prevents unauthorized access to or from a private network. All, data packets in it are entering or dropping network passes through the firewall and after checking, whether the firewall allows it or not. All traffic must pass through the firewall and only authorized, traffic must pass. It is a system located between two networks where it implements an access, control policy between those networks. It works on network layer of the OSI model and uses, encryption to encrypt the data before transmission., 2. Proxy Server :, Proxy Server is a server that acts as a gateway or intermediary between any device and the rest, of the internet. A proxy accepts and forwards connection requests, then returns data for those, requests, 55.Code for Binary Search Tree and binary tree?:, 1. Binary Search tree can be defined as a class of binary trees, in which the nodes are, arranged in a specific order. This is also called ordered binary tree., 2. In a binary search tree, the value of all the nodes in the left sub-tree is less than the, value of the root., SVC – 11/11/2020
Page 53 :
3. Similarly, value of all the nodes in the right sub-tree is greater than or equal to the value, of the root., 4. This rule will be recursively applied to all the left and right sub-trees of the root., , 56.What is the difference between deque and doubly linked list?, A deque is an abstract data structure. It can be implemented either using a linked list or an, array. On the other hand, a doubly linked list is a concrete data structure, i.e. its implementation, would be same for every programmer., 57.SQL query to print top 5 salary of a person in a table?, , SVC – 11/11/2020
Page 54 :
select *from employee where salary in (selectdistincttop5 salary from employee orderby salary, desc), 58.What is page fault?, A page fault is a type of exception raised by computer hardware when a running program, accesses a memory page that is not currently mapped by the memory management unit into the, virtual address space of a process., 59.What is java collection framework?, The Java collections framework is a set of classes and interfaces that implement commonly, reusable collection data structures. Although referred to as a framework, it works in a manner, of a library., 60. What is interface?, An interface in Java is a blueprint of a class. It has static constants and abstract methods., The interface in Java is a mechanism to achieve abstraction. There can be only abstract, methods in the Java interface, not method body. It is used to achieve abstraction and, multiple inheritance in Java., 61.What is intersection of two arrays?, Given two unsorted arrays that represent two sets (elements in every array are distinct),, find union and intersection of two arrays. Then your program should print Union as {1, 2, 3,, 5, 6, 7, 8, 20} and Intersection as {3, 6, 7}. Note that the elements of union and intersection, can be printed in any order., 62. What is multiple inheritance?, Consider a scenario where A, B, and C are three classes. The C class inherits A and B classes., If A and B classes have the same method and you call it from child class object, there will be, ambiguity to call the method of A or B class. This is not supported in java through class., To reduce the complexity and simplify the language, multiple inheritance is not supported in, java., 63. What is bubble sort and selection sort?, Bubble sort and Selection sort are the sorting algorithms which can be differentiated through, the methods they use for sorting. Bubble sort essentially exchanges the elements whereas, selection sort performs the sorting by selecting the element., Bubble sort:, Bubble sort is the simplest iterative algorithm operates by comparing each item or element, with the item next to it and swapping them if needed. In simple words, it compares the first and, second element of the list and swaps it unless they are out of specific order. Similarly, Second, and third element are compared and swapped, and this comparing and swapping go on to the, end of the list., SVC – 11/11/2020
Page 55 :
Selection sort:, The selection sort algorithm sorts an array by repeatedly finding the minimum element, (considering ascending order) from unsorted part and putting it at the beginning. The algorithm, maintains two subarrays in a given array., 1) The subarray which is already sorted., 2) Remaining subarray which is unsorted., , SVC – 11/11/2020