INDEX Sr. 1
Company Nama COGNZIANT
2
DELOITTE
3
GOOGLE
4
ABYETI TECHNOLOGIES
5
JK TECHNOSOFT
6
MICROSOFT
7
MICROSOFT TECHNICAL QUESTIONS
8
NINE LEAPS
9
WIPRO
10
HASHEDIN TECHNOLOGIES
11
MIND TREE
12
VIRTUSA (PE-2001)
13
PERSISTENT SYSTEM
14
WIPRO
15
VMWARE
16
INFORMATICA
17
FOURKITES
18
MU SIGMA
19
CLICK LABS PVT LTD
20
MICRO FOCUS PLACEMENT DRIVE
21
BA CONTINUUM
22
NEXT SCM
23
EPAM
24
BLUEPI
25
NEWGEN
26
CAPGEMINI
27
GRAY B
28
NIIT
29
AMAZON
30
SOFT PRODIGY
31
ZS ASSOCIATES
32
EVRY INDIA PVT. LTD.
33
MAVEN WAVE
33
JUST DIAL
34
BROADCOM
35
EVALUESERVE
36
SAPIENT
37
BRILLO TECHNOLOGIES
38
ORANGE BUSINESS SERVICE
39
EASTERN SOFTWARE DE FACTO INFOTECH
40
Drive Name: COGNZIANT Technical interview 1. Which is your favorite subject? Student based Questions 2. What is OOPS? Give real life example? Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data. The programming challenge was seen as how to write the logic, not how to define the data. Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than the logic required to manipulate them. Examples of objects range from human beings (described by name, address, and so forth) to buildings and floors (whose properties can be described and managed) down to the little widgets on a computer desktop (such as buttons and scroll bars). The first step in OOP is to identify all the objects the programmer wants to manipulate and how they relate to each other, an exercise often known as data modeling. Once an object has been identified, it is generalized as a class of objects (think of Plato's concept of the "ideal" chair that stands for all chairs) which defines the kind of data it contains and any logic sequences that can manipulate it. Each distinct logic sequence is known as a method. Objects communicate with well-defined interfaces called messages. The concepts and rules used in object-oriented programming provide these important benefits:
The concept of a data class makes it possible to define subclasses of data objects that share some or all of the main class characteristics. Called inheritance, this property of OOP forces a more thorough data analysis, reduces development time, and ensures more accurate coding.
Since a class defines only the data it needs to be concerned with, when an instance of that class (an object) is run, the code will not be able to accidentally access other program data. This characteristic of data hiding provides greater system security and avoids unintended data corruption.
The definition of a class is reuseable not only by the program for which it is initially created but also by other object-oriented programs (and, for this reason, can be more easily distributed for use in networks).
The concept of data classes allows a programmer to create any new data type that is not already defined in the language itself.
For example consider we have a Class of Cars under which Santro Xing, Alto and WagonR represents individual objects. In this context each Car Object will have its own, Model,Year of Manufacture, Colour, Top Speed, Engine Power etc.,which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car class. No memory is allocated when a class is created. Memory is allocated only when an object is created, i.e., when an instance of a class is created.
3. Concepts of OOPS? Class Here we can take Human Being as a class. A class is a blueprint for any functional entity which defines its properties and its functions. Like Human Being, having body parts, and performing various actions. Inheritance Considering HumanBeing a class, which has properties like hands, legs, eyes etc, and functions like walk, talk, eat, see etc. Male and Female are also classes, but most of the properties and functions are included in HumanBeing, hence they can inherit everything from class HumanBeing using the concept of Inheritance. Objects My name is Abhishek, and I am an instance/object of class Male. When we say, Human Being, Male or Female, we just mean a kind, you, your friend, me we are the forms of these classes. We have a physical existence while a class is just a logical definition. We are the objects. Abstraction Abstraction means, showcasing only the required things to the outside world while hiding the details. Continuing our example, Human Being's can talk, walk, hear, eat, but the details are hidden from the outside world. We can take our skin as the Abstraction factor in our case, hiding the inside mechanism. Encapsulation This concept is a little tricky to explain with our example. Our Legs are binded to help us walk. Our hands, help us hold things. This binding of the properties to functions is called Encapsulation.
Polymorphism Polymorphism is a concept, which allows us to redefine the way something works, by either changing how it is done or by changing the parts using which it is done. Both the ways have different terms for them.If we walk using our hands, and not legs, here we will change the parts used to perform something. Hence this is called Overloading.And
if there is a defined way of walking, but I wish to walk differently, but using my legs, like everyone else. Then I can walk like I want, this will be called as Overriding. 4. Abstraction and Inheritance? Same as in Question Above. (Q.No 3 above) 5. Write any program. Student based Questions 6. Explain any of the projects. Student based Questions 7. Do you have any problem with relocation? Not technical
Drive Name: DELOITTE
Technical Interview: 1. Tell me about yourself. (HR Question) Ams: Depends upon Student. 2. What is the significance of OOPS? Give examples from real life. Explanation: The main purpose of C++ programming is to add object orientation to the C programming language and classes are the central feature of C++ that supports object-oriented programming and are often called user-defined types. A class is used to specify the form of an object and it combines data representation and methods for manipulating that data into one neat package. The data and functions within a class are called members of the class. For example consider we have a Class of Cars under which Santro Xing, Alto and WaganR represents individual Objects. In this context each Car Object will have its own, Model, Year of Manufacture, Color, Top Speed, Engine Power etc., which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car Class. No memory is allocated when a class is created. Memory is allocated only when an object is created, i.e., when an instance of a class is created. 3. Pillars of OOPS. Explanation: Object Oriented Programming is a paradigm that provides many concepts such as inheritance, data binding, polymorphism etc. Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts: Object Class Inheritance Polymorphism Abstraction Encapsulation
Object Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical. Class Collection of objects is called class. It is a logical entity. Inheritance When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism. Polymorphism When one task is performed by different ways i.e. known as polymorphism. For example: to convince the customer differently, to draw something e.g. shape or rectangle etc.
In C++, we use Function overloading and Function overriding to achieve polymorphism. Abstraction Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't know the internal processing. In C++, we use abstract class and interface to achieve abstraction. Encapsulation Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines.
4. Abstraction. (Security in Java). Explanation: Abstraction in Java Abstraction is a process of hiding the implementation details and showing only functionality to the user. Another way, it shows only essential things to the user and hides the internal details, for example, sending SMS where you type the text and send the message. You don't know the internal processing about the message delivery. Abstraction lets you focus on what the object does instead of how it does it. Ways to achieve Abstraction There are two ways to achieve abstraction in java Abstract class (0 to 100%) Interface (100%) Abstract class in Java A class which is declared as abstract is known as an abstract class. It can have abstract and non-abstract methods. It needs to be extended and its method implemented. It cannot be instantiated. Points to Remember An abstract class must be declared with an abstract keyword. It can have abstract and non-abstract methods. It cannot be instantiated. It can have constructors and static methods also. It can have final methods which will force the subclass not to change the body of the method. Java interface There are mainly three reasons to use interface. They are given below. It is used to achieve abstraction. By interface, we can support the functionality of multiple inheritance. It can be used to achieve loose coupling. 5. Encapsulation Explanation: Encapsulation
Binding (or wrapping) code and data together into a single unit are known as encapsulation. For example capsule, it is wrapped with different medicines. A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here. 6. Polymorphism and its application in any of my projects . Explanation: Polymorphism If one task is performed by different ways, it is known as polymorphism. For example: to convince the customer differently, to draw something, for example, shape, triangle, rectangle, etc. In Java, we use method overloading and method overriding to achieve polymorphism. Application can be to speak something; Application, a cat speaks meow, dog barks woof, etc. 7. Tell me about 2 projects one was on Android and the other was a Data Analytics Project. 8. What is Operating system? Explanation: An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also include accounting software for cost allocation of processor time, mass storage, printing, and other resources. For hardware functions such as input and output and memory allocation, the operating system acts as an intermediary between programs and the computer hardware, although the application code is usually executed directly by the hardware and frequently makes system calls to an OS function or is interrupted by it. Operating systems are found on many devices that contain a computer – from cellular phones and video game consoles to web servers and supercomputers. 9. How does a Java program works in accordance with the operating system? Explanation: Java Program Java, being a platform independent programming language, doesn’t work on one-step-compilation. Instead, it involves a two-step execution, first through an OS independent compiler; and second, in a virtual machine (JVM) which is custom-built for every operating system. The two principle stages are explained below: Compilation First, the source ‘.java’ file is passed through the compiler, which then encodes the source code into a machine independent encoding, known as Bytecode. The content of each class contained in the source file is stored in a separate ‘.class’ file. While converting the source code into the bytecode, the compiler follows the following steps: Parse: Reads a set of *.java source files and maps the resulting token sequence into AST (Abstract Syntax Tree)-Nodes. Enter: Enters symbols for the definitions into the symbol table. Process annotations: If Requested, processes annotations found in the specifed compilation units. Attribute: Attributes the Syntax trees. This step includes name resolution, type checking and constant folding.
Flow: Performs dataflow analysis on the trees from the previous step. This includes checks for assignments and reachability. Desugar: Rewrites the AST and translates away some syntactic sugar. Generate: Generates ‘.Class’ files. Execution The class files generated by the compiler are independent of the machine or the OS, which allows them to be run on any system. To run, the main class file (the class that contains the method main) is passed to the JVM, and then goes through three main stages before the final machine code is executed. These stages are: Class Loader The main class is loaded into the memory by passing its ‘.class’ file to the JVM, through invoking the latter. All the other classes referenced in the program are loaded through the class loader. A class loader, itself an object, creates a flat name space of class bodies that are referenced by a string name.Bytecode Verifier After the bytecode of a class is loaded by the class loader, it has to be inspected by the bytecode verifier, whose job is to check that the instructions don’t perform damaging actions. The following are some of the checks carried out: Variables are initialized before they are used. Method calls match the types of object references. Rules for accessing private data and methods are not violated. Local variable accesses fall within the runtime stack. The run time stack does not overflow. If any of the above checks fails, the verifier doesn’t allow the class to be loaded. Just-In-Time Compiler This is the final stage encountered by the java program, and its job is to convert the loaded bytecode into machine code. When using a JIT compiler, the hardware can execute the native code, as opposed to having the JVM interpret the same sequence of bytecode repeatedly and incurring the penalty of a relatively lengthy translation process. This can lead to performance gains in the execution speed, unless methods are executed less frequently.
10. What is Machine Learning? What are its types? Explanation: Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine learning focuses on the development of computer programs that can access data and use it learn for themselves. The process of learning begins with observations or data, such as examples, direct experience, or instruction, in order to look for patterns in data and make better decisions in the future based on the examples that we provide. The primary aim is to allow the computers learn automatically without human intervention or assistance and adjust actions accordingly. Some machine learning methods Machine learning algorithms are often categorized as supervised or unsupervised. Supervised machine learning algorithms can apply what has been learned in the past to new data using labeled examples to predict future events. Starting from the analysis of a known training dataset, the learning
algorithm produces an inferred function to make predictions about the output values. The system is able to provide targets for any new input after sufficient training. The learning algorithm can also compare its output with the correct, intended output and find errors in order to modify the model accordingly. In contrast, unsupervised machine learning algorithms are used when the information used to train is neither classified nor labeled. Unsupervised learning studies how systems can infer a function to describe a hidden structure from unlabeled data. The system doesn’t figure out the right output, but it explores the data and can draw inferences from datasets to describe hidden structures from unlabeled data. Semi-supervised machine learning algorithms fall somewhere in between supervised and unsupervised learning, since they use both labeled and unlabeled data for training – typically a small amount of labeled data and a large amount of unlabeled data. The systems that use this method are able to considerably improve learning accuracy. Usually, semi-supervised learning is chosen when the acquired labeled data requires skilled and relevant resources in order to train it / learn from it. Otherwise, acquiringunlabeled data generally doesn’t require additional resources. Reinforcement machine learning algorithms is a learning method that interacts with its environment by producing actions and discovers errors or rewards. Trial and error search and delayed reward are the most relevant characteristics of reinforcement learning. This method allows machines and software agents to automatically determine the ideal behavior within a specific context in order to maximize its performance. Simple reward feedback is required for the agent to learn which action is best; this is known as the reinforcement signal. 11. Tell me about your Management system project? Draw all the tables relations used in your project. What were the primary keys used or all other constraints in those relations? 12. Where do you see yourself in 7 years: As a Project Manager As a Developer As a Decision Analyst And why? Give reasons for no choosing other options?
Drive Name: Google 1. This type of cable is plugged into the network adapter and allows you to connect to a network. A. HDMI B. Ethernet C. VGA D. Serial Answer B Explanation: Ethernet is a family of computer networking technologies commonly used in local area networks (LAN), metropolitan area networks (MAN) and wide area networks (WAN). It was commercially introduced in 1980 and first standardized in 1983 as IEEE 802.3, and has since been refined to support higher bit rates and longer link distances. 2. 802. 1x is…. A. The theoretical throughput speed of fast Ethernet B. A networking standard used for authentication C. The latest Ubuntu release build number D. The max distance Category 5 Ethernet data can travel before degradation Answer B Explanation: IEEE 802.1X is an IEEE Standard for port-based Network Access Control (PNAC). It is part of the IEEE 802.1 group of networking protocols. It provides an authentication mechanism to devices wishing to attach to a LAN or WLAN. 3. What Windows utility allows you to view running processes? A. Process viewer B. Activity Monitor C. Registry D. Task Manager Answer D Explanation: Task Manager, previously known as Windows Task Manager, is a task manager, system monitor, and startup manager included with Microsoft Windows systems. It provides information about computer performance and running software, including name of running processes, CPU load, commit charge, I/O details, logged-in users, and Windows services. Task Manager can also be used to set process priorities, processor affinity, start and stop services, and forcibly terminate processes.
4. Asmall, self-contained network is generally called a _________ A. LAN B. WAN C. MAN Answer A
D. STAN
Explanation: A local area network (LAN) is a group of computers and associated devices that share a common communications line or wireless link to a server. Typically, a LAN encompasses computers and peripherals connected to a server within a distinct geographic area such as an office or a commercial establishment. 5. This is an example of an IANA reserved private IP address. A. 168.192.23.5
B. 16.172.12.99 C. 12.10.10.1 D. 192.168.15.12 Answer D Explanation: Several address ranges are reserved for "Special Use". These addresses all have restrictions of some sort placed on their use, and in general should not appear in normal use on the public Internet. The overview below briefly explains the purpose of these addresses – in general they are used in specialized technical contexts. They are described in more detail in RFC 6890. "Private Use" IP addresses: 10.0.0.0 - 10.255.255.255 172.16.0.0 - 172.31.255.255 192.168.0.0 - 192.168.255.255 These address blocks are reserved for use on private networks, and should never appear in the public Internet. There are millions of private networks (for example home firewalls often use them). People can use these address blocks without informing us, so we have no record of who uses which of these addresses. The point of private address space is to allow many organizations in different places to use the same addresses, and as long as these disconnected or self-contained islands of IP-speaking computers (private networks) are not connected, there is no problem. If you see an apparent attack, or spam, coming from one of these address ranges, then either it is coming from your local environment, your ISP, or the address has been "spoofed". The Private addresses are documented in RFC 1918. If you have further questions about RFC 1918 usage, please contact your ISP. "Autoconfiguration" IP Addresses: 169.254.0.0 - 169.254.255.255 Addresses in the range 169.254.0.0 to 169.254.255.255 are used automatically by most network devices when they are configured to use IP, do not have a static IP Address assigned and are unable to obtain an IP address using DHCP. This traffic is intended to be confined to the local network, so the administrator of the local network should look for misconfigured hosts. Some ISPs inadvertently also permit this traffic, so you may also want to contact your ISP. This is documented in RFC 6890. "Loopback" IP addresses: 127.0.0.0 - 127.255.255.255 Each computer on the Internet uses 127.0.0.0/8 to identify itself, to itself. 127.0.0.0 to 127.255.255.255 is earmarked for what is called "loopback". This construct allows a computer to confirm that it can use IP and for different programs running on the same machine to communicate with each other using IP. Most software only
uses 127.0.0.1 for loopback purposes (the other addresses in this range are seldom used). All of the addresses within the loopback address are treated with the same levels of restriction in Internet routing, so it is difficult to use any other addresses within this block for anything other than node specific applications, generally bootstraping. This is documented in RFC 6890. "Unallocated" IP addresses: The IPv4 Address Registry and the Whois use the word unallocated (sometimes "reserved") to mean that the addresses are reserved for future allocation. No one should be using these addresses now. These addresses will be assigned for use in the public Internet in the future. If addresses are needed for private networks then the private-use addresses mentioned above should be used. Multicast IP addresses: 224.0.0.0 - 239.255.255.255 Addresses in the range 224.0.0.0 to 239.255.255.255 are set aside for the special purpose of providing multicast services in the Internet. Multicast services allow a computer to send a single message to many destinations. Examples include the software that keeps computers’ clocks synchronised and television services delivered over IP, typically by cable ISPs. Various addresses in this range are used by routers and others are used by hosts that are listening to multicast sessions. 6. Many versions of linux use this kind of licensing, which means the source code is made freely available and can be redistributed or modified. A. open source B. free C. pirated D. public domain Answer A Explanation: Open-source software (OSS) is a type of computer software in which source code is released under a license in which the copyright holder grants users the rights to study, change, and distribute the software to anyone and for any purpose. Open-source software may be developed in a collaborative public manner. According to scientists who have studied it, open-source software is a prominent example of open collaboration. The term is often written without a hyphen as "open source software". 7. This is a collection of databases of configurations in Windows operating systems. A. Registry B. Config database C. Sys Files D. Task Manager Answer A Explanation: The Windows Registry is a hierarchical database that stores low-level settings for the Microsoft Windows operating system and for applications that opt to use the registry. The kernel, device drivers, services, Security Accounts Manager, and user interface can all use the registry. The registry also allows access to counters for profiling system performance. In simple terms, the registry or Windows Registry contains information, settings, options, and other values for programs and hardware installed on all versions of Microsoft Windows operating systems. For example, when a program is installed, a new subkey containing settings such as a program's location, its version, and how to start the program, are all added to the Windows Registry.
8. This command line utility in Windows will display the network address and related information. A. ipconfig B. show network C. ifconfig D. view-ip Answer A Explanation: Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays Internet Protocol version 4 (IPv4) and IPv6 addresses, subnet mask, and default gateway for all adapters. 9. This IP address is called a “loopback” address. A. 192.168.1.1 B. 255.255.255.254 C. 169.168.1.1 D. 127.0.0.1 Answer D Explanation: Loopback address is a special IP number (127.0.0.1) that is designated for the software loopback interface of a machine. The loopback interface has no hardware associated with it, and it is not physically connected to a network. 10. This is a system used to automatically assign IP addresses on a network. A. IP-Auto B. DNS C. CUPS D. DHCP Answer D Explanation: Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway. 11. What Unix-based Mac command line utility can be used to query a machine’s IP address? A. view-ip B. ifconfig C. ipconfig D. show network Answer C Explanation: Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays Internet Protocol version 4 (IPv4) and IPv6 addresses, subnet mask, and default gateway for all adapters. 12. This linux user account is similar to an administrative account on windows and has default access to all files and commands. A. admin B. root C. superuser D. default Answer B Explanation: Root is the user name or account that by default has access to all commands and files on a Linux or other Unix-like operating system. It is also referred to as the root account, root user and the superuser. 13. The ‘brains’ of a computer is normally referred to as this.
A. DHCP
B. CPU
C. BIOS
D. RAM
Answer: B Explanation: CPU is the abbreviation for central processing unit. Sometimes referred to simply as the central processor, but more commonly called processor, the CPU is the brains of the computer where most calculations take place. 14. What protocol is used to transmit web pages over the internet? A. WWW B. HTTP C. SSH
D. FTP
Answer B Explanation: HTTP is based on the TCP/IP protocols, and is used commonly on the Internet for transmitting web-pages from servers to browsers. 15. Where can you view system logs in Windows? A. Event Viewer B. Log Reader C. Registry D. Add/Remove Programs Answer: A Explanation: Event Viewer is a component of Microsoft's Windows NT line of operating systems that lets administrators and users view the event logs on a local or remote machine. 16. What is the name of the Mac command line environment? A. Terminal B. Command Interface C. Command Prompt D. Console Answer: A Explanation: Terminal provides a command line interface to control the UNIX-based operating system that lurks below macOS (or Mac OS X). 17. This refers to the broadcasted name of a wireless network: A. DHCP B. SSID C. Net ID
D. DNS
Answer B Explanation: A service set identifier (SSID) is a sequence of characters that uniquely names a wireless local area network (WLAN). An SSID is sometimes referred to as a "network name." 18. Peripherals such as keyboards and mice are connected through this prost. A. PCI B. HDMI C. Ethernet D. USB Answer D Explanation: USB (abbreviation of Universal Serial Bus) is an industry standard that establishes specifications for cables, connectors and protocols for connection, communication and power supply between personal computers and their peripheral devices. 19. You can enter Windows Safe Mode by hitting which key(s) during the boot up sequence. A. Enter B. F8 C. F10 D. Ctrl + Alt + Del
Answer B Explanation: The F8 key is called a function key. This key is usually used to enter the Windows Startup menu or the Advanced Boot Options. 20. This software built-in to a motherboard allows you to select the boot up device along with other hardware configuration options. A. POST B. BIOS C. RAM D. HDD Answer B Explanation: BIOS (basic input/output system) is the program a personal computer's microprocessor uses to get the computer system started after you turn it on. It also manages data flow between the computer's operating system and attached devices such as the hard disk, video adapter, keyboard, mouse and printer. 21. The unique hardware id which is used to identify each device on a network is more commonly called…. A. SSID B. NIC C. IP Address D. Mac Address Answer C Explanation: An Internet Protocol address (IP address) is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. An IP address serves two principal functions: host or network interface identification and location addressing. 22. When a PC is powered on, it uses this process to test hardware functionality. A. BIOS B. Boot loader C. Hardware Self-Test D. POST Answer D Explanation: POST (Power-On Self-Test) is the diagnostic testing sequence that a computer's basic input/output system (or "starting program") runs to determine if the computer keyboard, random access memory, disk drives, and other hardware are working correctly. If the necessary hardware is detected and found to be operating properly, the computer begins to boot. If the hardware is not detected or is found not to be operating properly, the BIOS issues an error message which may be text on the display screen and/or a series of coded beeps, depending on the nature of the problem. Since POST runs before the computer's video card is activated, it may not be possible to progress to the display screen. The pattern of beeps may be a variable numbers of short beeps or a mixture of long and short beeps, depending on what type of BIOS is installed. 23. Which of this is a type of volatile memory? A. CMOS B. RAM C. ROM
D. BIOS
Answer B Explanation: Random-access memory (RAM) is a form of computer data storage that stores data and machine code currently being used. A random-access memory device allows data items to be read or written in almost the same amount of time irrespective of the physical location of data inside the memory. 24. This is considered the central module of the Linux operating system that connects hardware to software. A. run level B.kernel C. root D. CPU Answer B
Explanation: A kernel is the central part of an operating system. It manages the operations of the computer and the hardware - most notably memory and CPU time. There are two types of kernels: A micro kernel, which only contains basic functionality; A monolithic kernel, which contains many device drivers. 25. This file format is a mountable disk image commonly used to install applications in OSX. A. plist B. dmg C. exe D. dll Answer B Explanation: A DMG file is a mountable disk image created in Mac OS X. It contains raw block data typically compressed and sometimes encrypted. DMG files are commonly used for OS X software installers that are downloaded from the Internet and mounts a virtual disk on the desktop when opened. 26. The IP address, 192.168.1.105, is in which class? A. Class D B. Class A C. Class C
D. Class B
Answer C Explanation: The first octet of Class C IP address has its first 3 bits set to 110, that is: Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet mask for Class C is 255.255.255.x. Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses. 27. This protocol is connectionless and is commonly used to transmit voice and video data over the internet. A. FTP B. TCP C. UDP D. APB Answer C Explanation: UDP (User Datagram Protocol) is an alternative communications protocol to Transmission Control Protocol (TCP) used primarily for establishing low-latency and loss-tolerating connections between applications on the internet. 28. This piece of software, embedded in a chip on the motherboard, allows you to select boot up devices in addition to other configuration options: A. BIOS B. RAM C. Configurator D. Ssd Answer A Explanation: BIOS (basic input/output system) is the program a personal computer's microprocessor uses to get the computer system started after you turn it on. It also manages data flow between the computer's operating system and attached devices such as the hard disk, video adapter, keyboard, mouse and printer. 29. Per second, what is the theoretical maximum speed rating of a Gigabit Ethernet connection? A. 1000 Gigabits B. 2000 Megabits C. 1000 Megabits D. 1000 Megabytes Answer C Explanation: The Gigabit Ethernet standard supports a theoretical maximum data rate of 1 gigabit per second (Gbps) (1000 Mbps). When first developed, some thought achieving gigabit speeds with Ethernet would require using fiber optic or other special network cable technology. However, that's only necessary for long distances. 30. This Windows utility allows you install or uninstall applications.
A. Add/Remove Programs B. Device Manager C. Windows Application Installer D. Task Manager Answer A Explanation: In the Control Panel you can quickly access the old Add or Remove Programs by clicking or tapping the "Uninstall a program" link found in the Programs section. 31. This is a network utility used to test connectivity to another device on the network. A. nslookup B. nslookup C. ping D. ipconfig Answer C Explanation: Ping is a networking utility program or a tool to test if a particular host is reachable. It is a diagnostic that checks if your computer is connected to a server. Ping, a term taken from the echo location of a submarine, sends data packet to a server and if it receives a data packet back, then you have a connection. 32. This is an encryption method commonly used in wireless networks. A. WPA2 B. WAMS C. DHCP D. Wifi-Strong Answer A Explanation: WPA2 is a type of encryption used to secure the vast majority of Wi-Fi networks. A WPA2 network provides unique encryption keys for each wireless client that connects to it. 33. This is a security application in Windows that allows you to filter incoming and outgoing network data. A. Windows Shield B. Windows Anti-Virus C. Windows Blocker D. Windows Firewall Answer D Explanation: The Windows Firewall is a security application created by Microsoft and built into Windows, designed to filter network data transmissions to and from your Windows system and block harmful communications and/or the programs that are initiating them. 34. This utility can be used to check log messages in OSX. A. Console B. Logger C. Message Viewer D. Event Log Answer A Explanation: Alternatively referred to as a computer console, root console, system console, or terminal. Console is a basic computer or monitor and keyboard that is connected to another computer, server, or a mainframe over a network. It is used to maintain or monitor the status of the network or computer. 35. Which one of these is not a result of the command ‘ipconfig /all’ A. DNS Servers B. Default Gateway C. DHCP Server D. Physical Address Answer D
Explanation: A physical address is a binarynumber in the form of logical high and low states on an address busthat corresponds to a particular cell of primary storage(also called main memory), or to a particular register in a memory-mapped I/O(input/output) device. 36. Which of the following is NOT a Linux distribution? A. Derpian B. Fedora C. CentOS D. openSUSE Answer A Explanation: A Linux distribution (often abbreviated as distro) is an operating system made from a software collection, which is based upon the Linux kernel and, often, a package management system. 37. Which of these is a type of hard drive? A.SSD B. LCD C. FTP D. SSH Answer A Explanation: An SSD (solid-state drive) is a type of nonvolatile storage media that stores persistent data on solidstate flash memory.The architectural configuration of the SSD controller is optimized to deliver high read and write performance for both sequential and random data requests.
38. What does the acronym RAM stand for? A. Router Access Machine C. Random-Access Memory
B. Router Access Memory D. Read-only Access Memory
Answer C Explanation: Random-access memory (RAM) is a form of computer data storage that stores data and machine code currently being used. A random-access memory device allows data items to be read or written in almost the same amount of time irrespective of the physical location of data inside the memory. 39. This networking service translates web domains to IP addresses. A. DNS B. DHCP C. WINS
D. HTTP
Answer A Explanation: The Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names, like nytimes.com or espn.com. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names to IP addresses so browsers can load Internet resources. 40. What Windows utility allows you to configure hardware devices? A. Event Viewer B. Device Manager C. Drive installer D. Hardware Manger Answer B Explanation: Device Manager is a Control Panel applet in Microsoft Windows operating systems. It allows users to view and control the hardware attached to the computer. When a piece of hardware is not working, the offending hardware is highlighted for the user to deal with. The list of hardware can be sorted by various criteria.
Drive Name: Abyeti Technologies Book Index: 61-(B)
TECHNICA L CODING TEST 1. An array of input is given with negative as well as positive values. Sort them using Stacks only. You can use as many of stacks you want but no array. Print the final Output of sorted input. // Function to Rearrange positive and negative // numbers in a array void RearrangePosNeg(int arr[], int n) { int key, j; for(int i = 1; i < n; i++) { key = arr[i]; // if current element is positive // do nothing if (key > 0) continue; /* if current element is negative, shift positive elements of arr[0..i-1], to one position to their right */ j = i - 1; while (j >= 0 && arr[j] > 0) { arr[j + 1] = arr[j]; j = j - 1; }
}
// Put negative element at its right position arr[j + 1] = key;
}
2. Problem: 1. Print a specific pattern int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { cout<<”*”; } cout<<”\n”; }
2. Given 2 numbers (where 6 can also be written as 5, and 5 as 6), calculate the maximum and minimum possible sum int replaceDig(int x, int from, int to) { int result = 0; int multiply = 1; while (x % 10 > 0) { int reminder = x % 10; // Required digit found, replace it if (reminder == from) result = result + to * multiply; else
result = result + reminder * multiply;
multiply *= 10; x = x / 10; } return result; } // Returns maximum and minimum possible sums of // x1 and x2 if digit replacements are allowed. void calculateMinMaxSum(int x1, int x2) { // We always get minimum sum if we replace // 6 with 5. int minSum = replaceDig(x1, 6, 5) + replaceDig(x2, 6, 5);
}
// We always get maximum sum if we replace // 5 with 6. int maxSum = replaceDig(x1, 5, 6) + replaceDig(x2, 5, 6); cout << "Minimum sum = " << minSum; cout << "nMaximum sum = " << maxSum;
3. Find sum of all values of (a[j]-a[i]) where j>i and j-i is a prime. int maxIndexDiff(int arr[], int n) { int maxDiff = -1; int i, j; for (i = 0; i < n; ++i) { for (j = n-1; j > i; --j) {
if(arr[j] > arr[i] && maxDiff < (j - i)) maxDiff = j - i; } }
}
return maxDiff;
int main() { int arr[] = {9, 2, 3, 4, 5, 6, 7, 8, 18, 0}; int n = sizeof(arr)/sizeof(arr[0]); int maxDiff = maxIndexDiff(arr, n); printf("\n %d", maxDiff); getchar(); return 0; }
3. Problem Knight and Queen Problem it is famous DP problem . #include<stdio.h> #define N 8 int solveKTUtil(int x, int y, int movei, int sol[N][N], int xMove[], int yMove[]); /* A utility function to check if i,j are valid indexes for N*N chessboard */ bool isSafe(int x, int y, int sol[N][N]) { return ( x >= 0 && x < N && y >= 0 && y < N && sol[x][y] == -1); } /* A utility function to print solution matrix sol[N][N] */ void printSolution(int sol[N][N]) { for (int x = 0; x < N; x++) { for (int y = 0; y < N; y++) printf(" %2d ", sol[x][y]); printf("\n"); } } /* This function solves the Knight Tour problem using Backtracking. This function mainly uses solveKTUtil() to solve the problem. It returns false if no complete tour is possible, otherwise return true and prints the tour. Please note that there may be more than one solutions, this function prints one of the feasible solutions. */
bool solveKT() { int sol[N][N]; /* Initialization of solution matrix */ for (int x = 0; x < N; x++) for (int y = 0; y < N; y++) sol[x][y] = -1; /* xMove[] and yMove[] define next move of Knight. xMove[] is for next value of x coordinate yMove[] is for next value of y coordinate */ int xMove[8] = { 2, 1, -1, -2, -2, -1, 1, 2 }; int yMove[8] = { 1, 2, 2, 1, -1, -2, -2, -1 }; // Since the Knight is initially at the first block sol[0][0] = 0; /* Start from 0,0 and explore all tours using solveKTUtil() */ if (solveKTUtil(0, 0, 1, sol, xMove, yMove) == false) { printf("Solution does not exist"); return false; } else printSolution(sol); return true; } /* A recursive utility function to solve Knight Tour problem */ int solveKTUtil(int x, int y, int movei, int sol[N][N], int xMove[N], int yMove[N]) { int k, next_x, next_y; if (movei == N*N) return true; /* Try all next moves from the current coordinate x, y */ for (k = 0; k < 8; k++) { next_x = x + xMove[k]; next_y = y + yMove[k]; if (isSafe(next_x, next_y, sol)) { sol[next_x][next_y] = movei; if (solveKTUtil(next_x, next_y, movei+1, sol, xMove, yMove) == true) return true; else sol[next_x][next_y] = -1;// backtracking } } }
return false;
/* Driver program to test above functions */ int main() { solveKT(); return 0; }
TECHNICAL INTERVIEW 1. 8 ball puzzle proc weight n { set num [expr {int(log($n*2-1)/log(3))+1}] set len [expr {$n/3}] set pn 0 set pri {2 5 7 11 13 17 19 23 29 31 37 41 43 59 61 67} for {set i 0} {$i < $num} {incr i} { set a {} while {![llength $a]} { set a {} set b {} set c {} while { ($n+1)%[lindex $pri $pn]==0 ||($n-1)%[lindex $pri $pn]==0 ||$n%[lindex $pri $pn]==0} {incr pn; puts $pn} set cpn [lindex $pri $pn] for {set j 0} {$j < $len} {incr j} { set tmp [expr {($j*$cpn)%$n}] lappend a $tmp incr tmp 1 if {$tmp in $a} {set a {}; break} lappend b $tmp } incr pn } for {set j 0} {$j < $n} {incr j} { if {$j ni $a && $j ni $b} {lappend c $j} } puts "[lsort -integer $a] VS [lsort -integer $b] - Which is havier? -1 = left, 0 = equal, 1 = right" set idx [expr {[gets stdin] + 1}] if {$i == 0} { if {$idx == 1} { set p1 $c set p2 $c } elseif {$idx == 0} { set p1 $a set p2 $b } else { set p1 $b set p2 $a } } else { set lists [list $a $c $b] set p1 [lmap it [lindex $lists $idx] {if {$it ni $p1} continue; set it}] set p2 [lmap it [lindex $lists 2-$idx] {if {$it ni $p2} continue; set it}]
} } if {[llength $p1]} {puts "Result $p1"} {puts "Result $p2"} } puts "Number of balls?" weight [gets stdin]
2. 2.5 ltr 3ltr jar puzzle Similar solution(Exactly not found)
Using a 3L and a 5L bottle, an exact quantity of 4L can be taken out of an unknown water source. Let us denote 3L bottle the first bottle and 5L bottle the second one. The steps are as follows:
Fill the second bottle from the source. Fill the first bottle using the water from second bottle. Now we have 3L water in first bottle and 2L in the second bottle. Empty the first bottle in the source. Now the first bottle is empty and 2L in second bottle. Now empty the second bottle in the first bottle. Now the first bottle has 2L quantity and the second bottle is empty. Now fill the second bottle from the source. At this instance the first bottle has 2L quantity and 5L in second bottle. Now empty 1L from second bottle in the first bottle, as it has a 3L capacity so only 1L more water can be accommodated. At this point the first bottle is full and 4L in the second bottle.
Hence we have 4L water (desired quantity) in the second bottle.
3. A company has employees. An employee can also be a manager. Let A, B, C, D, E, F, G are employees such that A is manager for B,C,D and B is manager for E,F,G. Design database to store the given information. Write a query to retrieve the names of employees working under any manager. import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class NumberEmployeeUnderManager { // A hashmap to store result. It stores count of employees // under every employee, the count may by 0 also static Map<String,Integer> result = new HashMap<String, Integer>(); // Driver function public static void main(String[] args) {
Map<String, String> dataSet = new HashMap<String, String>(); dataSet.put("A", "C"); dataSet.put("B", "C"); dataSet.put("C", "F"); dataSet.put("D", "E"); dataSet.put("E", "F"); dataSet.put("F", "F"); populateResult(dataSet); System.out.println("result = " + result); } // This function populates 'result' for given input 'dataset' private static void populateResult(Map<String, String> dataSet) { // To store reverse of original map, each key will have 0 // to multiple values Map<String, List<String>> mngrEmpMap = new HashMap<String, List<String>>(); // To fill mngrEmpMap, iterate through the given map for (Map.Entry<String,String> entry: dataSet.entrySet()) { String emp = entry.getKey(); String mngr = entry.getValue(); if (!emp.equals(mngr)) // excluding emp-emp entry { // Get the previous list of direct reports under // current 'mgr' and add the current 'emp' to the list List<String> directReportList = mngrEmpMap.get(mngr); // If 'emp' is the first employee under 'mgr' if (directReportList == null) directReportList = new ArrayList<String>(); directReportList.add(emp); // Replace old value for 'mgr' with new // directReportList mngrEmpMap.put(mngr, directReportList); }
}
// Now use manager-Emp map built above to populate result // with use of populateResultUtil() // note- we are iterating over original emp-manager map and // will use mngr-emp map in helper to get the count for (String mngr: dataSet.keySet()) populateResultUtil(mngr, mngrEmpMap); } // This is a recursive function to fill count for 'mgr' using // mngrEmpMap. This function uses memoization to avoid re// computations of subproblems. private static int populateResultUtil(String mngr, Map<String, List<String>> mngrEmpMap)
{
int count = 0; // means employee is not a manager of any other employee if (!mngrEmpMap.containsKey(mngr)) { result.put(mngr, 0); return 0; } // this employee count has already been done by this // method, so avoid re-computation else if (result.containsKey(mngr)) count = result.get(mngr); else {
List<String> directReportEmpList = mngrEmpMap.get(mngr); count = directReportEmpList.size(); for (String directReportEmp: directReportEmpList) count += populateResultUtil(directReportEmp, mngrEmpMap);
}
result.put(mngr, count); } return count;
}
4. How so you check if a tree is a BST? What if the definition of this tree is altered a little. int isBST(struct node* node) { if (node == NULL) return 1; /* false if left is > than node */ if (node->left != NULL && node->left->data > node->data) return 0; /* false if right is < than node */ if (node->right != NULL && node->right->data < node->data) return 0; /* false if, recursively, the left or right is not a BST */ if (!isBST(node->left) || !isBST(node->right)) return 0; /* passing all that, it's a BST */ return 1; }
5. Data Structure and N-ary tree implementation
A binary tree is a structure comprising nodes, where each node has the following 3 components: 1. Data element: Stores any kind of data in the node 2. Left pointer: Points to the tree on the left side of node 3. Right pointer: Points to the tree on the right side of the node As the name suggests, the data element stores any kind of data in the node. The left and right pointers point to binary trees on the left and right side of the node respectively. If a tree is empty, it is represented by a null pointer. The following image explains the various components of a tree.
Commonly-used terminologies
Root: Top node in a tree Child: Nodes that are next to each other and connected downwards Parent: Converse notion of child Siblings: Nodes with the same parent Descendant: Node reachable by repeated proceeding from parent to child Ancestor: Node reachable by repeated proceeding from child to parent. Leaf: Node with no children Internal node: Node with at least one child External node: Node with no children
Structure code of a tree node In programming, trees are declared as follows:
struct node { int data; struct node * left; struct node * right; };
//Data element //Pointer to left node //Pointer to right node
Creating nodes Simple node struct node root;
Pointer to a node struct node * root; root=(node * )malloc(sizeof(node));
In this case, you must explicitly allocate the memory of the node type to the pointer (preferred method). Utility function returning node struct node * newnode(int element) { struct node * temp=(node * )malloc(sizeof(node)); temp->data=element; temp->left=temp->right=NULL; return temp; }
Maximum depth/height of a tree The idea is to do a post-order traversal and maintain two variables to store the left depth and right depth and return max of both the depths. int maxDepth(struct node* node) { if (node==NULL) return 0; else { /* compute the depth of each subtree */ int lDepth = maxDepth(node->left); int rDepth = maxDepth(node->right); /* use the larger one */ if (lDepth > rDepth)
return(lDepth+1); else }
return(rDepth+1);
}
Time complexity O(n) Application of trees 1. 2. 3. 4. 5.
a Manipulate hierarchical data Make information easy to search (see tree traversal) Manipulate sorted lists of data Use as a workflow for compositing digital images for visual effects Use in router algorithms
6. String manipulation A string is a sequence of characters. In other words, a string is an array of character data type. An instance of a string is called a string literal. For instance in C++: string s = "HackerEarth"; s is a string literal. String Manipulation is a class of problems where a user is asked to process a given string and use/change its data. An example question would be a great way to understand the problems that are usually classified under this category.
Given a string S of length N, shift each character of the string by K positions to the right, where K≤N.
For example: Say S = "hacker" and K=2. Here N=6. Shifting each character in S by 2 positions to the right would result into erhack. Note that S[0] i.e. 'h' is moved by 2 positions to the S[2]. Also, S[5] i.e. 'r', which is the last character in S comes round-about back to S[1] as there is no space for 'r' to go beyond the limits of string length. Approach:
Declare another auxillary string shiftedS that is of the same size as S. Copy ith element of S to the (K+i)th position in shiftedS. This means, shiftedS[i+K]=S[i] where 0≤i
Implementation: void shiftByK(char S[], char shiftedS[], int N, int K) { // Iterate through the length of given string for(int i=0; i
}
shiftedS[idx] = S[i]; } // Add a NULL character to mark the end of string shiftedS[N] = '\0';
Every character array in C/C++ ends with a '\0' (NULL) character. It marks the end of the string. If it is not added in the end, then the code may produce garbage characters after the string.
7. Binary tree mirror image
The idea is to write a recursive function isMirror() that takes two trees as argument and returns true if trees are mirror and false if trees are not mirror. The isMirror() function recursively checks two roots and subtrees under the root. Below is implementation of above algorithm. // C++ program to check if a given Binary Tree is symmetric or not #include
using namespace std; // A Binary Tree Node struct Node { int key; struct Node* left, *right; }; // Utility function to create new Node Node *newNode(int key) { Node *temp = new Node; temp->key = key; temp->left = temp->right = NULL; return (temp); } // Returns true if trees with roots as root1 and root2 are mirror bool isMirror(struct Node *root1, struct Node *root2) { // If both trees are emptu, then they are mirror images if (root1 == NULL && root2 == NULL) return true; // For two trees to be mirror images, the following three // conditions must be true // 1 - Their root node's key must be same // 2 - left subtree of left tree and right subtree // of right tree have to be mirror images // 3 - right subtree of left tree and left subtree // of right tree have to be mirror images if (root1 && root2 && root1->key == root2->key) return isMirror(root1->left, root2->right) && isMirror(root1->right, root2->left);
// if neither of above conditions is true then root1 // and root2 are not mirror images return false; } // Returns true if a tree is symmetric i.e. mirror image of itself bool isSymmetric(struct Node* root) { // Check if tre is mirror of itself return isMirror(root, root); } // Driver program int main() { // Let us construct the Tree shown in the above figure Node *root = newNode(1); root->left = newNode(2); root->right = newNode(2); root->left->left = newNode(3); root->left->right = newNode(4); root->right->left = newNode(4); root->right->right = newNode(3);
}
cout << isSymmetric(root); return 0;
8. Multithreading Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilization of CPU. Each part of such program is called a thread. So, threads are lightweight processes within a process.
Threads can be created by using two mechanisms : 1. Extending the Thread class 2. Implementing the Runnable Interface
Thread creation by extending the Thread class We create a class that extends the java.lang.Thread class. This class overrides the run() method available in the Thread class. A thread begins its life inside run() method. We create an object of our new class and call start() method to start the execution of a thread. Start() invokes the run() method on the Thread object. class MultithreadingDemo extends Thread { public void run() {
try { // Displaying the thread that is running System.out.println ("Thread " + Thread.currentThread().getId() + " is running"); } catch (Exception e) { // Throwing an exception System.out.println ("Exception is caught"); } }
}
// Main Class public class Multithread { public static void main(String[] args) { int n = 8; // Number of threads for (int i=0; i<8; i++) { MultithreadingDemo object = new MultithreadingDemo(); object.start(); } } }
9. Exception Handling
Exception handling is the process of responding to the occurrence, during computation, of exceptions – anomalous or exceptional conditions requiring special processing – often changing the normal flow of program execution. It is provided by specialized programming language constructs, computer hardware mechanisms like interrupts or operating system IPC facilities like signals. In general, an exception breaks the normal flow of execution and executes a pre-registered exception handler. The details of how this is done depends on whether it is a hardware or software exception and how the software exception is implemented. Some exceptions, especially hardware ones, may be handled so gracefully that execution can resume where it was interrupted. Alternative approaches to exception handling in software are error checking, which maintains normal program flow with later explicit checks for contingencies reported using special return values or some auxiliary global variable such as C's errno or floating point status flags; or input validation to preemptively filter exceptional cases. A different view of exceptions is based on the principles of design by contract and is supported in particular by the Eiffel language. The idea is to provide a more rigorous basis for exception handling by defining precisely what is "normal" and "abnormal" behavior. Specifically, the approach is based on two concepts:
Failure: the inability of an operation to fulfill its contract. For example, an addition may produce an arithmetic overflow (it does not fulfill its contract of computing a good approximation to the mathematical sum); or a routine may fail to meet its postcondition.
Exception: an abnormal event occurring during the execution of a routine (that routine is the "recipient" of the exception) during its execution. Such an abnormal event results from the failure of an operation called by the routine.
The "Safe Exception Handling principle" as introduced by Bertrand Meyer in Object-Oriented Software Construction then holds that there are only two meaningful ways a routine can react when an exception occurs:
Failure, or "organized panic": The routine fixes the object's state by re-establishing the invariant (this is the "organized" part), and then fails (panics), triggering an exception in its caller (so that the abnormal event is not ignored). Retry: The routine tries the algorithm again, usually after changing some values so that the next attempt will have a better chance to succeed.
10.Oops concepts OOPS Concept Definitions Now, let us discuss some of the main features of Object Oriented Programming which you will be using in C++ (technically). 1.
Objects
2.
Classes
3.
Abstraction
4.
Encapsulation
5.
Inheritance
6.
Overloading
7.
Exception Handling
Objects Objects are the basic unit of OOP. They are instances of class, which have data members and uses various member functions to perform tasks. Class It is similar to structures in C language. Class can also be defined as user defined data type but it also contains functions in it. So, class is basically a blueprint for object. It declare & defines what data variables the object will have and what operations can be performed on the class's object. Abstraction Abstraction refers to showing only the essential features of the application and hiding the details. In C++, classes can provide methods to the outside world to access & use the data variables, keeping the variables hidden from direct access, or classes can even declare everything accessible to everyone, or maybe just to the classes inheriting it. This can be done using access specifiers.
Encapsulation It can also be said data binding. Encapsulation is all about binding the data variables and functions together in class. Inheritance Inheritance is a way to reuse once written code again and again. The class which is inherited is called the Base class & the class which inherits is called the Derived class. They are also called parent and child class. So when, a derived class inherits a base class, the derived class can use all the functions which are defined in base class, hence making code reusable. Polymorphism It is a feature, which lets us create functions with same name but different arguments, which will perform different actions. That means, functions with same name, but functioning in different ways. Or, it also allows us to redefine a function to provide it with a completely new definition. You will learn how to do this in details soon in coming lessons. Exception Handling Exception handling is a feature of OOP, to handle unresolved exceptions or errors produced at runtime. 11.Data Structure - Linked List , Like arrays, Linked List is a linear data structure. Unlike arrays, linked list elements are not stored at
contiguous location; the elements are linked using pointers. Arrays can be used to store linear data of similar types, but arrays have following limitations. 1) The size of the arrays is fixed: So we must know the upper limit on the number of elements in advance. Also, generally, the allocated memory is equal to the upper limit irrespective of the usage. 2) Inserting a new element in an array of elements is expensive, because room has to be created for the new elements and to create room existing elements have to shifted. // A linked list node struct Node { int data; struct Node *next; };
1. Binary Tree , BST
The following is definition of Binary Search Tree(BST) according to Binary Search Tree, is a node-based binary tree data structure which has the following properties:
The left subtree of a node contains only nodes with keys lesser than the node’s key. The right subtree of a node contains only nodes with keys greater than the node’s key. The left and right subtree each must also be a binary There must be no duplicate nodes.
// C function to search a given key in a given BST struct node* search(struct node* root, int key) { // Base Cases: root is null or key is present at root if (root == NULL || root->key == key) return root; // Key is greater than root's key if (root->key < key) return search(root->right, key); // Key is smaller than root's key return search(root->left, key); }
search
tree.
Drive Name: JK TECHNOSOFT Book Index: 71-(B)
1.
What is Bootstrap? Bootstrap is a free and open-source front-end framework for designing websites and web applications. It contains HTML- and CSS-based design templates for typography, forms, buttons, navigation and other interface components, as well as optional JavaScript extensions.
2.
From a Table, How will you print two distinct elements? void printDistinct(int arr[], int n) { // Pick all elements one by one for (int i=0; i
3.
What is Normalization (SQL)?
Normalization is the process of reorganizing data in a database so that it meets two basic requirements: (1) There is no redundancy of data (all data is stored in only one place), and (2) data dependencies are logical (all related data items are stored together). Normalization is important for many reasons, but chiefly because it allows databases to take up as little disk space as possible, resulting in increased performance.Normalization is also known as data normalization.
4.
About .NET and Its Input Output Operations? Output functions: Write() writeLine(): create new line automatically Input Functions: read() readLine():Reads the whole linea
5.
What are IIS and JSP Servalets in Java?
Java Server Page (JSP) is a technology for controlling the content or appearance of Web pages through the use of servlets, small programs that are specified in the Web page and run on the Web server to modify the Web page before it is sent to the user who requested it. Sun Microsystems, the developer of Java, also refers to the JSP technology as the Servlet application program interface (API). JSP is comparable to Microsoft's Active Server Page (ASP) technology. Whereas a Java Server Page calls a Java program that is executed by the Web server, an Active Server Page contains a script that is interpreted by a script interpreter (such as VBScript or JScript) before the page is sent to the user. IIS, or more specifically its Active Server Page (ASP) environment, contains a core group of classes that virtually mirror those of the Java Servlet specification. ... You have to adapt (or wrap) the IIS versions of the objects to make them look and act like servlet versions. A servlet is a Java programming language class that is used to extend the capabilities of servers that host applications accessed by means of a request-response programming model. Although servletscan respond to any type of request, they are commonly used to extend the applications hosted by web servers. 6.
What is the syntax for Java Class? public class Dog { String breed; int age; String color; void barking() { } void hungry() { } void sleeping() { } }
7.
What is Access Specifies?
An access specifier is a defining code element that can determine which elements of a program are allowed to access a specific variable or other piece of data. Different programming languages have their own protocols for access
specifiers, as well as defaults for some code elements including both individual variables and classes.they are of 3 types: 1. Public: access allowed 2. Private:access not allowed outside the class 3. Protected:can 8.
access
in
inheritance.
What Is Default Scope? Private in c++ and in java also.
9.
What is the query of inner Joins ,Outer Join, Constant, Unique Key, Primary key, Inheritance ,Programs Related to Linked List , In capsulation , Abstraction (there real Life Examples ) INNER JOIN: The INNER JOIN keyword selects all rows from both the tables as long as the condition satisfies. This keyword will create the result-set by combining all rows from both the tables where the condition satisfies i.e value of the common field will be same. Syntax
SELECT table1.column1,table1.column2,table2.column1,.... FROM table1 INNER JOIN table2 ON table1.matching_column = table2.matching_column; This query will show the names and age of students enrolled in different courses. SELECT StudentCourse.COURSE_ID, Student.NAME, Student.AGE FROM Student INNER JOIN StudentCourse ON Student.ROLL_NO = StudentCourse.ROLL_NO;
OUTER JOIN when performing an inner join, rows from either table that are unmatched in the other table are not returned. In an outer join, unmatched rows in one or both tables can be returned. There are a few types of outer joins:
LEFT JOIN returns only unmatched rows from the left table. RIGHT JOIN returns only unmatched rows from the right table. FULL OUTER JOIN returns unmatched rows from both tables. Example of Left Outer Join:
SELECT companies.permalink AS companies_permalink, companies.name AS companies_name, acquisitions.company_permalink AS acquisitions_permalink, acquisitions.acquired_at AS acquired_date FROM tutorial.crunchbase_companies companies LEFT JOIN tutorial.crunchbase_acquisitions acquisitions ON companies.permalink = acquisitions.company_permalink
UNIQUE KEY All tables in your databse should have a PK (although this is not enforced by most dbms), and PK can span multiple columns. Unique key constraints are used to ensure that data is not duplicated in two rows in the database. One row in the database is allowed to have null for the value of the unique key constraint PRIMARY KEY A primary key is a special relational database table column (or combination of columns) designated to uniquely identify all table records. A primary key'smain features are: It must contain a unique value for each row of data. It cannot contain null values.
10. What is SQ Lite? SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file. The database file format is cross-platform - you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures. These features make SQLite a popular choice as an Application File Format. SQLite database files are a recommended storage format by the US Library of Congress. Think of SQLite not as a replacement for Oracle but as a replacement for fopen() SQLite is a compact library. With all features enabled, the library size can be less than 600KiB, depending on the target platform and compiler optimization settings. (64-bit code is larger. And some compiler optimizations such as aggressive function inlining and loop unrolling can cause the object code to be much larger.) There is a tradeoff between memory usage and speed. SQLite generally runs faster the more memory you give it. Nevertheless, performance is usually quite good even in low-memory environments. Depending on how it is used, SQLite can be faster than direct filesystem I/O. SQLite is very carefully tested prior to every release and has a reputation for being very reliable. Most of the SQLite source code is devoted purely to testing and verification. An automated test suite runs millions and millions of test cases involving hundreds of millions of individual SQL statements and achieves 100% branch test coverage. SQLite responds gracefully to memory allocation failures and disk I/O errors. Transactions are ACID even if interrupted by system crashes or power failures. All of this is verified by the automated tests using special test harnesses which simulate system failures. Of course, even with all this testing, there are still bugs. But unlike some similar projects (especially commercial competitors) SQLite is open and honest about all bugs and provides bugs lists and minuteby-minute chronologies of code changes.
The SQLite code base is supported by an international team of developers who work on SQLite full-time. The developers continue to expand the capabilities of SQLite and enhance its reliability and performance while maintaining backwards compatibility with the published interface spec, SQL syntax, and database file format. The source code is absolutely free to anybody who wants it, but professional support is also available.
11. Database Query: Takeout a name from the table given? Answer:
Select name from the student where rollno=1;
Student is “TableName” Name is the “ColumnName representing names of the student’ Rollno is the “ColumnName” 12. What are the real life examples of Stack and Queue? Stack: Queue:
Pile of dinner plates Movie ticket window
13. What are DDL and DML? DML statements are SQL statements that manipulate data. DML stands for Data Manipulation Language. The SQL statements that are in the DML class are INSERT, UPDATE and DELETE. Some people also lump the SELECT statement in the DML classification. Data Definition Languages (DDL) are used to define the database structure. Any CREATE, DROP and ALTER commands are examples of DDL SQL statements 14. Difference between SQ Lite and My SQL? Sqlite is embeddable relational database management system. SQL is query language. ... Unlike other databases (like SQL Server and MySQL) SQLite does not support stored procedures. SQLite is file-based, unlike other databases, like SQL Server and MySQL which are server-based. 15. Where SQL is used? Give Real Life examples? Data is stored in databases which in turn stores the data in tables that contains rows and columns. There are several database applications available to handle the storage and management of data examples include Oracle, Microsoft SQL and MySQL. ... Adding new record into a database. Deleting records from a database.e.g Hospital records of patients and doctors. 16. Difference between KOTLIN and Java?
Null Safety - As already mentioned in above section that Kotlin avoids NullPointerException. Kotlin fails at compile-time whenever a NullPointerException may be thrown.
Data Classes - In Kotlin there are Data Classes which leads to autogeneration of boilerplate like equals, hashCode, toString, getters/setters and much more. Extension Functions - Kotlin allows us to extend the functionality of existing classes without inheriting from them. Means to say that Kotlin provides the ability to extend a class with new functionality without having to inherit from the class. This is done by extension functions. To declare an extension function, we need to prefix its name with a receiver type, i.e. the type being extended.
17. Have you heard about GO Language? For the language released in 2003 by McCabe and Clark, see Go! (programming language). "Google Go" redirects here. For the computer program by Google to play the board game Go, see AlphaGo. Go (often referred to as Golang[12]) is a programming language designed by Google[13] engineers Robert Griesemer, Rob Pike, and Ken Thompson.[10] Go is a statically typed, compiled language in the tradition of C, with the added benefits of memory safety, garbage collection, structural typing,[3] and CSP-style concurrency. [14] The compiler, tools, and source code are all free and open source.[15] 18. Write a program of Fibonannci Series?
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; } 19. What are main concepts of OOPS? Objects: Objects are the basic run-time entities in an object-oriented programming. They may represents a person, a place, a bank account, a table of data or any item that the program has to handle. They may also represents user-defined data such as vector, time and lists. When the program is executed, the object interact by sending message to one another. Classes:
Objects contain data, and code to manipulate that data. The entire set of data and code of an object can be made a user-defined data type with the help of class. In fact, objects are variable of the type class. Once a class has been defined, we can create a number of objects belonging to that class. A class is a collection of objects of similar type. Ex. Fruit mango; Data Abstraction: Abstractions refer to the act of representing essential features without including background details or explanation. They are commonly known as Abstraction Data Type(ADT). Encapsulation: The wrapping up of data and functions into single unit is known as encapsulation. Data encapsulation is a striking feature of a class. The data is not accessible to the outside world, and only those functions which are wrapped in the class can access it. These functions provide the interface between the object's data and the program. Inheritance: Inheritance is the process by which objects of one class acquire the properties of object of another class. The class whose members are inherited is called the Base class and the class that inherits those members is called Derived class. It supports class of hierarchical classification. The concept of inheritance provides the ideas of reusability. This means we can add essential features to an exciting class without modifying it. Polymorphism: Polymorphism is another OOP concept. Polymorphism means the ability to take more than one form. An operation may exhibit different behaviors at different instances. 20. There is a Bridge in .NET And Database, What it is called? This interface acts as a bridge between an RDBMS system and a .Net application. ADO.NET is such an interface that is created to connect .NET applications toRDBMS systems. In the .NET framework, Microsoft introduced a new version of Active X Data Objects (ADO) called ADO.NET. ... ADO reduces the number of objects. 21. What is static Queue? A static queue is one that is defined ahead of time and the queue definition persists in the environment. A dynamic queue is created on demand. ... A temporary dynamic queue is created on demand and is deleted when the program that created it disconnects.
22. What is Project Architecture? What kind of Database you have used? Write its Database. Ans: Ans: Project Architecure means what are the tiers in our project with flow diagram. supposoe our project contains five tiers like client tier ,presentation tier, Business tier,Integration tier,Data tier. then we draw the all tiers flow. Project approch is different from project architecure. Client tier:
IE Browser (default) from which the end user will access the application The request from the browser will be submitted to the Application Server using HTTP protocol. The Response from the presentation layer (struts framework) will be interpreted into html pages to view on the browsers. Presentation Tier: Struts Framework with Tiles On Request from the browser, the appropriate Action Class handles the user request. The Action class then connects to the business tier via Service Business Delegate. Tiles have been used to create a set of pages with a consistent user interface (e.g.: the same navigation bar, header, footer, etc.). Taglibs are used for displaying tabular data (e.g. search results) in a consistent fashion, with pagination. Business Delegate layer Enable the Struts Action classes to be unaware Encapsulates the invocation of Service Locator to locate them.
of
underlying
Session
Beans
Business Tier The Business Delegate identifies the business service class (the Session EJBs) and delegates client request to the EJBs. Internally, the session beans are shallow, and delegate all business logic requests to business logic POJOs, which in turn implement the actual functionality. The Business Logic POJOs encapsulate the server side business logic. They do not use Hibernate directly, but instead call upon Data Access Objects (DAO) to work with the model. Parameters and return values are modeled as Data Transfer Objects (DTO), and hence no Hibernate model classes will ever leave the DAO layer. The business logic is made available in the business service class, which increases maintainability and easy debugging, if necessary. DB Tier The DAOs encapsulates the database access. For all practical purposes, we are using Hibernate (v 2.1) as the OR mapping layer. This saves development time to write SQLs for executing insert and update statements, find by primary key etc. For each value object that directly or compositely represent a table in the database, we have Hibernate mapping files. For some complex data retrieval, however we will be using raw SQLs (independent of database) from the DAOs and populate the Value Object POJOs. In those specific cases, the DAOs will be having direct access to the Databases using the available connection. The connection properties of the ?DB Manager?, holding the data sources, direct the request to the appropriate database. 23.
What is Cloud Computing? What are its platforms? What are its advantages? What are its disadvantages? Why it was started? What are its Modules?
Ans: Cloud computing is the the use of various services, such as software development platforms, servers, storage and software, over the internet, often referred to as the "cloud." In general, there are three cloud computing characteristics that are common among all cloud-computing vendors: 1. The back-end of the application (especially hardware) is completely managed by a cloud vendor. 2. A user only pays for services used (memory, processing time and bandwidth, etc.). 3. Services are scalable Many cloud computing advancements are closely related to virtualization. The ability to pay on demand and scale quickly is largely a result of cloud computing vendors being able to pool resources that may be divided among multiple clients.
It is common to categorize cloud computing services as infrastructure as a service (IaaS), platform as a service (PaaS) or software as a service (SaaS). Cloud Computing advantages Cloud computing is an emerging technology that almost every company switched to from on-premise technologies. Whether it is public, private or hybrid, Cloud computing has become an essential factor for the companies to achieve competitive. Let us find out why Cloud is so much preferred over on-premise technologies
Cost efficiency – The biggest reason behind shifting to cloud computing is that it takes considerably lesser cost than an on-premise technology. Now the companies need not store the data in disks anymore as the Cloud offers enormous space available saving money and resources of the companies.
High Speed – Cloud computing lets you deploy the service quickly in fewer clicks. This quick deployment lets you get the resources required for your system within fewer minutes.
Excellent accessibility – Storing the information in cloud allows you to access it anywhere, anytime regardless of the machine making it highly accessible and flexible technology of present times.
Back-up and restore data – Once the data is stored in Cloud, it is easier to get the back-up and recovery of that, which is quite a time taking process on-premise. Cloud Computing disadvantages Every technology has positive and negatives aspects that are highly important to discuss before implementing it. Aforementioned points highlight the benefits of using cloud technology and following discussion will outline the potential cons of Cloud Computing-
Security issues – At time storing data in cloud may pose serious challenge of information theft in front of the company. Though advanced security measures are deployed on cloud, still storing a confidential data in cloud can be a risky affair.
Low bandwidth – At times the bandwidth is low as many users are accessing cloud at the same time which causes its bandwidth to go down. With less speed the benefits of cloud computing cannot be realized.
Flexibility issues – The cloud services run on remote servers which make it hard for the companies to have control over software and hardware. The services at times do not run the way it should.
Incompatibility – Since entire infrastructure gets virtualized, incompatibility issues may arise at times that may pose serious challenges on the way of smooth running of services. 24. Why Is Cloud Computing Preferable? Ans: Kindly follow the advantages of Cloud Computing. 25. If there is a String A, B, C, D, E .Without affecting its elements, how will you reverse it? Ans: Simple Solution: 1) Create a temporary character array say temp[].
2) Copy alphabetic characters from given array to temp[]. 3) Reverse temp[] using standard string reversal algorithm. 4) Now traverse input string and temp in a single loop. Wherever there is alphabetic character is input string, replace it with current character of temp[]. Efficient Solution: Time complexity of above solution is O(n), but it requires extra space and it does two traversals of input string. We can reverse with one traversal and without extra space. Below is algorithm. 1) Let input string be 'str[]' and length of string be 'n' 2) l = 0, r = n-1 3) While l is smaller than r, do following a) If str[l] is not an alphabetic character, do l++ b) Else If str[r] is not an alphabetic character, do r-c) Else swap str[l] and str[r] 26. What is the difference between Stored Procedure and Function? Ans: Stored Procedure 1.Can have both input / output parameters 2. Stored procedure can’t call from the functions 3.It’s optional to return the value, as somestimes it returns 0 or n values 4. It allows insert/update/delete/select 5.Procedures cant be utilized in a select statement 6.Procedure cannot be used in SQL statements with WHERE/ HAVING/SELECT 7. Exception can be handled by try-catch block
Functions 1.Can have only input parameters 2.Functions can call from the stored procedures 3.It’s should return the value 4.It allows only select statement 5.Function is embedded in a select statement 6.SQL statements can be used with WHERE/HAVING/SELECT 7.Here, we can’t handle the exception, using trycatch block
27. What do you know about Data Structure? Ans: Data structure refers to methods of organizing units of data within larger data sets. Achieving and maintaining specific data structures help improve data access and value. Data structures also help programmers implement various programming tasks. 28. What is the working of Max Function? Ans: The max() function of PHP is used to find the numerically maximum value in an array or the numerically maximum value of several specified values. The max() function can take an array or several numbers as an argument and return the numerically maximum value among the passed parameters. The return type is not fixed, it can be an integer value or a float value based on input. Syntax: max(array_values) or
max(value1, value2, ...) Parameters: This function accepts two different types of arguments which are explained below: 1. array_values : It specifies an array containing the values. 2. value1, value2, … : It specifies two or more than two values to be compared. Return Value: The max() function returns the numerically maximum value. 29. What are Joins? What are its queries? Ans: Joins help retrieving data from two or more database tables. The tables are mutually related using primary and foreign keys. Types of joins Cross JOIN Cross JOIN is a simplest form of JOINs which matches each row from one database table to all rows of another. In other words it gives us combinations of each row of first table with all records in second table. Suppose we want to get all member records against all the movie records, we can use the script shown below to get our desired results.
SELECT * FROM `movies` CROSS JOIN `members` INNER JOIN The inner JOIN is used to return rows from both tables that satisfy the given condition. Suppose , you want to get list of members who have rented movies together with titles of movies rented by them. You can simply use an INNER JOIN for that, which returns rows from both tables that satisfy with given conditions.
SELECT members.`first_name` , members.`last_name` , movies.`title` FROM members ,movies WHERE movies.`id` = members.`movie_id` SELECT A.`first_name` , A.`last_name` , B.`title` FROM `members`AS A INNER JOIN `movies` AS B ON B.`id` = A.`movie_id` Outer JOINs MySQL Outer JOINs return all records matching from both tables . It can detect records having no match in joined table. It returns NULL values for records of joined table if no match is found. Sounds Confusing ? Let's look into an example LEFT JOIN Assume now you want to get titles of all movies together with names of members who have rented them. It is clear that some movies have not being rented by any one. We can simply use LEFT JOIN for the purpose.
The LEFT JOIN returns all the rows from the table on the left even if no matching rows have been found in the table on the right. Where no matches have been found in the table on the right, NULL is returned.
SELECT A.`title` , B.`first_name` , B.`last_name` FROM `movies` AS A LEFT JOIN `members` AS B ON B.`movie_id` = A.`id` Executing the above script in MySQL workbench gives.You can see that in the returned result which is listed below that for movies which are not rented, member name fields are having NULL values. That means no matching member found members table for that particular movie.
RIGHT JOIN RIGHT JOIN is obviously the opposite of LEFT JOIN. The RIGHT JOIN returns all the columns from the table on the right even if no matching rows have been found in the table on the left. Where no matches have been found in the table on the left, NULL is returned. In our example, let's assume that you need to get names of members and movies rented by them. Now we have a new member who has not rented any movie yet
SELECT A.`first_name` , A.`last_name`, B.`title` FROM `members` AS A RIGHT JOIN `movies` AS B ON B.`id` = A.`movie_id` "ON" and "USING" clauses In above JOIN query examples, we have used ON clause to match the records between table. USING clause can also be used for the same purpose. The difference with USING is it needs to have identical names for matched columns in both tables. In "movies" table so far we used its primary key with the name "id". We referred to same in "members" table with the name "movie_id". ALTER TABLE `movies` CHANGE `id` `movie_id` INT( 11 ) NOT NULL AUTO_INCREMENT; Next let's use USING with above LEFT JOIN example.
SELECT A.`title` , B.`first_name` , B.`last_name` FROM `movies` AS A LEFT JOIN `members` AS B USING ( `movie_id` ) Apart from using ON and USING with JOINs you can use many other MySQL clauses like GROUP BY, WHERE and even functions like SUM, AVG, etc. 30. What is Branding in HTML? Ans: The process involved in creating a unique name and image for a product in the consumers' mind, mainly through advertising campaigns with a consistent theme. Branding aims to establish a significant and differentiated presence in the market that attracts and retains loyal customers. 31. In which Programming Language, You are most comfortable with? Ans: Based on student feedback. 32. What are IAAS, PAAS, and SAAS? Ans: Software as a Service, also known as cloud application services, represent the most commonly utilized option for businesses in the cloud market. SaaS utilizes the internet to deliver applications to its users, which are managed by a third-party vendor. A majority of SaaS applications are run directly through the web browser, and do not require any downloads or installations on the client side Examples of SaaS Google Apps, Dropbox, Salesforce, Cisco WebEx, Concur, GoToMeeting PaaS: Platform as a Service Cloud platform services, or Platform as a Service (PaaS), provide cloud components to certain software while being used mainly for applications. PaaS provides a framework for developers that they can build upon and use to create customized applications. All servers, storage, and networking can be managed by the enterprise or a third-party provider while the developers can maintain management of the applications. Examples of PaaS AWS Elastic Beanstalk, Windows Azure, Heroku, Force.com, Google App Engine, Apache Stratos, OpenShift IaaS: Infrastructure as a Service Cloud infrastructure services, known as Infrastructure as a Service (IaaS), are made of highly scalable and automated compute resources. IaaS is fully self-service for accessing and monitoring things like compute, networking, storage, and other services, and it allows businesses to purchase resources on-demand and as-needed instead of having to buy hardware outright. Examples of IaaS DigitalOcean, Linode, Rackspace, Amazon Web Services (AWS), Cisco Metapod, Microsoft Azure, Google Compute Engine (GCE)
33. What is Azure (Microsoft) Ans: Microsoft has leveraged its constantly-expanding worldwide network of data centers to create Azure, a cloud platform for building, deploying, and managing services and applications, anywhere. Azure lets you add cloud capabilities to your existing network through its platform as a service (PaaS) model, or entrust Microsoft with all of your computing and network needs with Infrastructure as a Service (IaaS). Either option provides secure, reliable access to your cloud hosted data—one built on Microsoft’s proven architecture. Azure provides an ever expanding array of products and services designed to meet all your needs through one convenient, easy to manage platform. Below are just some of the capabilities Microsoft offers through Azure and tips for determining if the Microsoft cloud is the right choice for your organization. 34. What is web view App (in Android)? How will it perform? Ans: Android system Webview app comes pre-installed into Android OS for rendering an in app browser as a part of activity layout. This in-app browser is what we term as Webviews. Webviews are the unique element of a hybrid application. Hybrid Applications – As the name suggests they are a mixture of Native and Web Applications. They are available in application store for download and require set of access from device like native apps, but they also have a browser embedded in the application(WebView) for rendering HTML. Instagram is a good example of a hybrid application. 35. How you can replace a number which is in middle of stack and link list? Ans: Solution Following example uses replaceAll() method to replace all the occurance of an element with a different element in a list. import java.util.*; public class Main { public static void main(String[] args) { List list = Arrays.asList("one Two three Four five six one three Four".split(" ")); System.out.println("List :"+list); Collections.replaceAll(list, "one", "hundread"); System.out.println("replaceAll: " + list); } } Result The above code sample will produce the following result. List :[one, Two, three, Four, five, six, one, three, Four] replaceAll: [hundread, Two, three, Four, five, six, hundread, three, Four]
36. In SQL if we have to take out an element from a Table then what is its query? Ans:
select TheFieldYouWant from YourTable where RowIdYouWant = 1 This will get from the table the row with Id = 1 and then, show you the field you want. You could put more fields, if you want to show more, or * to show all of them 37. Why we use SQL? What are benefits of Using SQL? Ans: SQL is important because of the following main reasons a. SQL helps you to find the needed information or data easily. b. SQL is a query language, not a programming language. You can easily write commands almost same as you write English. c. It quickly stores and gets data from the database quickly. SQL is used for the query, insert, collect and manages data from the database. d. Almost every database system will need SQL for further processing. Reasons to learn SQL if you are still not planning to learn it a. It doesn't require coding - SQL easily manages the database system without any requirement of adding significant code. It does so by using standard SQL. b. Portability - I think this is the main benefit of SQL. You can run SQL on PCs, laptop, servers, tablets, even on the smartphone. Also, the database can easily be moved from one device to other. c. Easy to learn - As I told you, it is the easiest language contains English statements. You can easily learn to write queries and manipulate data. d. SQL Standard - DQL databases are used by established standards. The first standard for this by ANSI (American National Standards Institute) in 1986 and ISO (International Standards Organization) in 1987. 38. What is ASP.NET? What is its Framework? Ans: ASP.NET is an open-source server-side web application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages(ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages. ASP.NET's successor is ASP.NET Core. It is a re-implementation of ASP.NET as a modular web framework, together with other frameworks like Entity Framework. The new framework uses the new open-source .NET Compiler Platform (codename "Roslyn") and is cross platform. ASP.NET MVC, ASP.NET Web API, and ASP.NET Web Pages (a platform using only Razor pages) have merged into a unified MVC 6. .NET Framework (pronounced dot net) is a software framework developed by Microsoft that runs primarily on Microsoft Windows. It includes a large class library named Framework Class Library (FCL) and provides language interoperability (each language can use code written in other languages) across several programming languages. Programs written for .NET Framework execute in a software environment (in contrast to a hardware environment) named Common Language Runtime(CLR), an application virtual
machine that provides services such as security, memory management, and exception handling. (As such, computer code written using .NET Framework is called "managed code".) FCL and CLR together constitute .NET Framework. FCL provides user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications. Programmers produce software by combining their source code with .NET Framework and other libraries. The framework is intended to be used by most new applications created for the Windows platform. Microsoft also produces an integrated development environment largely for .NET software called Visual Studio. .NET Framework began as proprietary software, although the firm worked to standardize the software stack almost immediately, even before its first release. Despite the standardization efforts, developers, mainly those in the free and open-source softwarecommunities, expressed their unease with the selected terms and the prospects of any free and open-source implementation, especially regarding software patents. Since then, Microsoft has changed .NET development to more closely follow a contemporary model of a community-developed software project, including issuing an update to its patent promising to address the concerns. .NET Framework led to a family of .NET platforms targeting mobile computing, embedded devices, alternative operating systems, and web browser plug-ins. A reduced version of the framework, .NET Compact Framework, is available on Windows CE platforms, including Windows Mobile devices such as smartphones. .NET Micro Framework is targeted at very resource-constrained embedded devices. Silverlight was available as a web browser plugin. Mono is available for many operating systems and is customized into popular smartphone operating systems (Android and iOS) and game engines. .NET Core targets the Universal Windows Platform (UWP), and cross-platform and cloud computing workloads
39. What are the drawbacks of using Cloud Computing?
Ans: Downtime As cloud service providers take care of a number of clients each day, they can become overwhelmed and may even come up against technical outages. This can lead to your business processes being temporarily suspended. Additionally, if your internet connection is offline, you will not be able to access any of your applications, server or data from the cloud. Security Although cloud service providers implement the best security standards and industry certifications, storing data and important files on external service providers always opens up risks. Using cloud-powered technologies means you need to provide your service provider with access to important business data. Meanwhile, being a public service opens up cloud service providers to security challenges on a routine basis. The ease in procuring and accessing cloud services can also give nefarious users the ability to scan, identify and exploit loopholes and vulnerabilities within a system. For instance, in a multi-tenant cloud architecture where multiple users are hosted on the same server, a hacker might try to break into the data of other users hosted and stored on the same server. However, such exploits and loopholes are not likely to surface, and the likelihood of a compromise is not great. Vendor Lock-In Although cloud service providers promise that the cloud will be flexible to use and integrate, switching cloud services is something that hasn’t yet completely evolved. Organizations may find it difficult to migrate their services from one vendor to another. Hosting and integrating current cloud applications on another platform may throw up interoperability and support issues. For instance, applications developed on Microsoft Development Framework (.Net) might not work properly on the Linux platform. Limited Control Since the cloud infrastructure is entirely owned, managed and monitored by the service provider, it transfers minimal control over to the customer. The customer can only control and manage the applications, data and services operated on top of that, not the backend infrastructure itself. Key administrative tasks such as server shell access, updating and firmware management may not be passed to the customer or end user.
40. How many Modules were there in Your Project? How you connected it with the database? How you Fetch the values from the database? Ans: Based on student Project
Company Name: - Microsoft Placement Drive Book Index: 108 – (C)
Technical 1. Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter MultiDequeue (Q) { N=k While (Q is not empty) and (n > Ө) { Dequeue (Q) n= n-1 } } What is the worst- case time complexity of a sequence of ‘m’ MultiDequeue () operations on an initially empty queue? A. Ө (mk) B. Ө (m) C. Ө (m2) D. Ө (m+k) Ans: A Explanation: Since the queue is empty initially, the condition of while loop never becomes true. So the time complexity is Ө (mk) 2. Let a priority queue be implemented as a Max- Heap. At first, it has 5 elements. The level-order traversal of the heap is 10,8,5,3,2. Two new elements 1 and 7 are inserted into the heap in that order. The level-order traversal of the heap after the insertion of the elements will be: A. 10,8,7,3,2,1,5 B. 10,8,7,2,3,1,5 C. 10,8,7,5,3,2,1 D. 10,8,7,1,2,3,5 Ans-c
Explanation: Initially heap has 10, 8, 5, 3, 2 10 / \ 8 5 / \ 3 2 After insertion of 1 10 / \
8 / \
5 /
3 2 1 No need to heapify as 5 is greater than 1.
After insertion of 7 10 / \ 8 5 / \ / \ 3 2 1 7 Heapify 5 as 7 is greater than 5 10 / \ 8 7 / \ / \ 3 2 1 5 No need to heapify any further as 10 is greater than 7
3. Four matrices A1,A2,A3and A4 of dimensions a × b, b × c, c × d and d × e respectively can be multiplied in several with the different number of total scalar multiplications. If a = 10 , b = 100, c = 20, d = 50 and e = 80, then at least how many scalar multiplications are required here? A. 80000 B. 44000 C. 14000 D. None of the mentioned options Ans: B Explanation 2-d array 4. Consider an array A[20,10]. Assume 4 words per memory cell and the base address of array A is 100. Find the address of A[11,5] assuming row-major storage. A. 420 B. 560 C. 650 D. 770 Ans: B Explanation. (0,0)---------(0,9) -
(10,0)-------(10,9) (11,0),---(11,4),.
Base address is 100. Address of (11,5)= 100+110x4+20=560. 5. Which of the following products of Microsoft is used as a database server? A. Microsoft Exchange Server B. Microsoft Access Server C. Microsoft SQL Server D. Microsoft Database Server Ans: C 6. Smallest scope to which Group Policy settings can be assigned is : A. Organizational Units B. Forest C. Domains D. None of these Ans: A 7. In Active Directory,__________ is a general purpose container that can be used to group most other classes together for administrative purposes. A. Domain B. Organizational units C. Forest D. Tree Ans: B 8. Which of the following is a Domain-wide Operations Master Role? A. RID Master B. BDC Emulator Master C. Infrastructure Master D. Schema Master Ans: C 9. Which of the following activities does and Active Directory Site help to facilitate? A. Authentication B. Replication C. Service Location D. All of these Ans: B 10. A hardware device in each of the nodes of the network, which is used to connect to the network is : A. Bridge B. Network Interface Card / Network Adapter C. Hub D. Cable Ans: B
11. __________ in AD DS represent the physical structure, or topology, of your network. A. Sites B. Links C. None of these D. DNS Ans: B 12. RPC stands for: A. Remote Process Call B. Remote Process Computer C. Remote Procedure Call D. Remote Process Client Ans: C 13. Active Directory supports multimaster replication of the directory data store between all domain controllers (DC) in the domain. A. False B. True Ans: A 14. What is the name of the snap – in that can be used to manage trusts in Active Directory? A. Active Directory Trusts Editor B. Active Directory Domains and Trusts C. Active Directory Trusts Management Tool D. Any of these Ans: B 15. Organizational Units can futher contain more Organizational Units A. False B. True Ans: A 16. To backup the Active Directory database, you need to have all the AD services in a stopped state. A. False B. True Ans: A 17. Which of the following represent an essential service in AD? A. KDC B. Netlogon C. Filre Replication D. All of these Ans: B 18. The first domain that is installed in the Active Directory Forest is referred as: A. Primary Domain B. Forest Domain C. Root Domain D. Key Domain Ans: A 19. Which of the following AD partitions get replicated to all the domain controllers of a forest?
A. B. C. D.
Schema Domain All of these Configuration
Ans: B 20. ___________ describes the characteristics of some aspect of an object in Active Directory. It defines the types of information that an object can hold. A. Class B. Schema C. Syntaxes D. Attributes Ans: A 21. A process P1 has a period of 50 and a CPU burst of 25 and P2has a period of 80, CPU burst of 35 then which of the following is the total CPU utilization? A. 0.94 B. 0.49 C. 0.6 D. 0.82 Ans: B Networking Technical 22. When data is transmitted from device (1) to device (2), the header from (1)’s 5 th layer is read by (2)’s: A. Physical layer B. None of the mentioned options C. Session layer D. Transport layer Answer: C Explanation: At device 1 the header from 5th layer that is session layer is read by the same layer at device 2 that is session layer. Because sender add the header and at the receiver same layer remove the header. So C is correct answer. 23. Which of the following is true regarding HTTP pipelining? A. Multiple HTTP requests are sent on a single TCP connection without waiting for the corresponding responses B. Multiple HTTP requests cannot be sent on a single TCP connection C. Multiple HTTP requests are sent in a queue on a single TCP connection D. None of the mentioned options Answer: A Sol: After three way handshaking, client can send multiple web requests without waiting for response. 24. Which of the following mentioned physical topologies is used in Fiber Distributed Data Interface (FDDI)? A. Ring B. Star C. Bus
D. Tree Ans: A
Sol. FDDI (Fiber Distributed Data Interface) is a set of ANSI and ISO standards for data transmission on fiber optic lines in a local area network (LAN) that can extend in range up to 200 km (124 miles). The FDDI protocol is based on the token ring protocol. In addition to being large geographically, an FDDI local area network can support thousands of users. FDDI is frequently used on the backbone for a wide area network (WAN). An FDDI network contains two token rings, one for possible backup in case the primary ring fails. The primary ring offers up to 100 Mbps capacity. If the secondary ring is not needed for backup, it can also carry data, extending capacity to 200 Mbps. The single ring can extend the maximum distance; a dual ring can extend 100 km (62 miles).
25. Which of the following command is used to copy a file from the client to the server? A. STOR command. B. LIST command. C. None of the mentioned D. RETR command. Ans: A Sol. The STORE (STOR) command is used by the client to tell the server to accept the data
transferred via the data connection and to store the data as a file at the server site. 26. Which of the following conditions should be satisfied by G(x) to detect the odd number of bits in error? A. G (x) does not divide 1+xk, for any k not exceeding the frame length B. G (x) has an odd number of terms. C. G (x) contains more than two terms D. 1 + x is a factor of G (x) Answer: D 27. Following given are the three different activities. A1: Send an email from a mail client to mail server A2: Download an email from mailbox server to a mail client A3: Checking email in a web browser Choose the application layer protocols which are generally used for each of these activities. A. A1: SMTP, A2:FTP, A3:HTTP B. A1: POP, A2: SMTP, A3:IMAP C. A1: SMTP, A2:POP, A3:HTTP D. A1: HTTP, A2:SMTP, A3:POP Answer: C Sol: 1. SMTP stands for Simple Mail Transfer Protocol. SMTP is used when email is delivered from an email client, such as Outlook Express, to an email server or when email is delivered from one email server to another. SMTP is a push protocol and is used to send the mail whereas POP (post office protocol) are used to retrieve those mails at the receiver’s side.
2. Stands for "Hypertext Transfer Protocol." HTTP is the protocol used to transfer data over the web. It is part of the Internet protocol suite and defines commands and services used for transmitting webpage data. HTTP uses a server-client model.
28. In Microsoft Windows Operating System, the size of the virtual address space varies for each hardware platform. A. Depends B. TRUE C. FALSE D. Question too ambiguous Ans: B
Sol: It depends on the OS for how much default process space is allocated. In Windows 64-bit, a default virtual address space for a process is 8 terabytes (there are a total of 2 ^ 24 addressable terabytes on a 64-bit byte addressable system) and in 32-bit it's only 2 GB (4 GB addressable total). 29. Arrange the order in which the below version of windows were released by Microsoft: 1. Windows 3.0 2. Windows Vista 3. Windows XP 4. Windows NT 5. Windows 2000 A. 53124 B. 14532 C. 34215 D. 12345 Answer: B Windows 3.0
22 May 1990
Windows NT 3.1 27 July 1993 Windows 2000
17 February 2000
Windows XP
25 October 2001
Windows Vista
30 January 2007
30. In the example “microsoft.com.”, which of the following statement is right? A. “microsoft.com.” represents the second level domain D B. “.com” represents the Top Level Domain C. All of these D. “.” represents the root domain Answer: C
31. What will be the bit rate in Ethemet when Manchester encoding is used? A. Four time the baud rate B. Twice the baud rate C. Half the baud rate D. Sane as the baud rate Answer: C Sol: In Manchester encoding, the bitrate is half of the baud rate. 32. Which of the following is the protocol data unit (PDU) for the application layer in the Internet stack? A. Frame B. Message C. Segment D. Datagram Ans: B Sol: The Layer 1 (Physical Layer) PDU is the bit or, more generally, symbol The Layer 2 (Data Link Layer) PDU is the frame. The Layer 3 (Network Layer) PDU is the packet. The Layer 4 (Transport Layer) PDU is the segment for TCP or the datagram for UDP. The Layer 5 (Application Layer) PDU is the data or message.
Drive Name: Microsoft Book Index: 108-(C)
Technical Interview 1. Tell me about yourself. Explanation: Not a technical question 2. What are the subjects that you studied in your 3 years of Engineering? Explanation: Answer will vary for each student. 3. Apart from Academics, What special preparations did you do for Microsoft? Explanation: Answer will vary for each student. 4. Tell me about process scheduling? Explanation: The act of determining which process is in the ready state, and should be moved to the running state is known as Process Scheduling. The prime aim of the process scheduling system is to keep the CPU busy all the time and to deliver minimum response time for all programs. For achieving this, the scheduler must apply appropriate rules for swapping processes IN and OUT of CPU. Scheduling fell into one of the two general categories:
Non Pre-emptive Scheduling: When the currently executing process gives up the CPU voluntarily.
Pre-emptive Scheduling: When the operating system decides to favour another process, pre-empting the currently executing process.
5. What is starvation? Explanation: Starvation is the name given to the indefinite postponement of a process because it requires some resource before it can run, but the resource, though available for allocation, is never allocated to this process. It is sometimes called live lock, though sometimes that name might be reserved for cases where the waiting process is doing something, but nothing useful, as in a spin lock. However it happens, starvation is self-evidently a bad thing; more formally, it's bad because we don't want a non-functional system. If starvation is possible in a system, then a process which enters the system can be held up for an arbitrary length of time. To avoid starvation, it is often said that we want the system's resources to be shared "fairly". This is an appealing suggestion, but in practice it isn't much use because it doesn't define what we mean by "fairly", so it's really more of a description of the problem than a contribution to its solution. It's more constructive to investigate the paths by which a system can reach a live locked state, and try to control them. 6. Context switching and paging. Explanation:
Context switching is the procedure of storing the state of an active process for the CPU when it has to start executing a new one. For example, process A with its address space and stack is currently being executed by the CPU and there is a system call to jump to a higher priority process B; the CPU needs to remember the current state of the process A so that it can suspend its operation, begin executing the new process B and when done, return to its previously executing process A. Context switches are resource intensive and most operating system designers try to reduce the need for a context switch. They can be software or hardware governed depending upon the CPU architecture. Context switches can relate to either a process switch, a thread switch within a process or a register switch. The major need for a context switch arises when CPU has to switch between user mode and kernel mode but some OS designs may obviate it. Paging is a memory management scheme that eliminates the need for contiguous allocation of physical memory. This scheme permits the physical address space of a process to be non – contiguous. Logical Address or Virtual Address (represented in bits): An address generated by the CPU Logical Address Space or Virtual Address Space( represented in words or bytes): The set of all logical addresses generated by a program Physical Address (represented in bits): An address actually available on memory unit Physical Address Space (represented in words or bytes): The set of all physical addresses corresponding to the logical addresses
7. Deadlocks. Ways to Avoid Deadlock. Explanation: In concurrent computing, a deadlock is a state in which each member of a group is waiting for some other member to take action, such as sending a message or more commonly releasing a lock. Deadlock is a common problem in multiprocessing systems, parallel computing, and distributed systems, where software and hardware locks are used to handle shared resources and implement process synchronization. In an operating system, a deadlock occurs when a process or thread enters a waiting state because a requested system resource is held by another waiting process, which in turn is waiting for another resource held by another waiting process. If a process is unable to change its state indefinitely because the resources requested by it are being used by another waiting process, then the system is said to be in a deadlock. Deadlock Avoidance
The general idea behind deadlock avoidance is to prevent deadlocks from ever happening, by preventing at least one of the aforementioned conditions. This requires more information about each process, AND tends to lead to low device utilization. ( I.e. it is a conservative approach. ) In some algorithms the scheduler only needs to know the maximum number of each resource that a process might potentially use. In more complex algorithms the scheduler can also take advantage of the schedule of exactly what resources may be needed in what order. When a scheduler sees that starting a process or granting resource requests may lead to future deadlocks, then that process is just not started or the request is not granted. A resource allocation state is defined by the number of available and allocated resources, and the maximum requirements of all processes in the system.
8. Define sub-netting. Explanation: Subnetting is the strategy used to partition a single physical network into more than one smaller logical sub-networks (subnets). An IP address includes a network segment and a host segment. Subnets are designed by accepting bits from the IP addresses host part and using these bits to assign a number of smaller sub-networks inside the original
network. Subnetting allows an organization to add sub-networks without the need to acquire a new network number via the Internet service provider (ISP). Subnetting helps to reduce the network traffic and conceals network complexity. Subnetting is essential when a single network number has to be allocated over numerous segments of a local area network (LAN). Subnets were initially designed for solving the shortage of IP addresses over the Internet. 9. What is cloud? What are its types? Explanation: In cloud computing, the word "cloud" (also phrased as "the cloud") is used as a metaphor for "the Internet," so the phrase cloud computing means a type of Internet-based computing, where different services —including servers, storage and applications — are delivered to an organization's computers and devices through the Internet. Cloud computing is an on-demand service that has obtained mass appeal in corporate data centres. The cloud enables the data centre to operate like the Internet and computing resources to be accessed and shared as virtual resources in a secure and scalable manner. Like most technologies, trends start in the enterprise and shift to adoption by small business owners. Types of clouds 1. Private CloudPrivate cloud solutions are dedicated to one business or organizations. Its often have much more specific security controls than does a public cloud. It may be owned, managed, and operated by the organization, a third party, or some combination of them, and it may exist on or off premises. Using private cloud storage allows them to control highly sensitive data by meeting regulations and industry-based criteria, whether that is medical records, trade secrets, or other classified information. 2. Public CloudPublic cloud solutions are readily available from Google, Microsoft, Amazon, and others. The cloud infrastructure is provisioned for open use by the general public. Gmail and “U” of “I” Box are examples of public cloud services. It may be owned, managed, and operated by a business, academic, or some combination of them, or government organization. 3. Hybrid CloudHybrid cloud is a cloud computing environment that uses a mix of on-premises, private cloud and third-party, public cloud services with orchestration between the two platforms. Hybrid cloud solutions are a blend of public and private clouds. 10. What is Machine Learning? Explanation: Machine learning is an application of artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine learning focuses on the development of computer programs that can access data and use it learn for themselves. The process of learning begins with observations or data, such as examples, direct experience, or instruction, in order to look for patterns in data and make better decisions in the future based on the examples that we provide. The primary aim is to allow the computers learn automatically without human intervention or assistance and adjust actions accordingly.
11. What is Active Directory? Explanation: Active Directory (AD) is a Windows OS directory service that facilitates working with interconnected, complex and different network resources in a unified manner. Active Directory was initially released with Windows 2000 Server and revised with additional features in Windows Server 2008. Active Directory provides a common interface for organizing and maintaining information related to resources connected to a variety of network directories. The directories may be systems-based (like Windows OS), application-specific or network resources, like printers. Active Directory serves as a single data store for quick data access to all users and controls access for users based on the directory's security policy. 12. Explain DHCP in detail. Explanation: Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway. RFCs 2131 and 2132 define DHCP as an Internet Engineering Task Force (IETF) standard based on Bootstrap Protocol (BOOTP), a protocol with which DHCP shares many implementation details. DHCP allows hosts to obtain necessary TCP/IP configuration information from a DHCP server. The Microsoft Windows Server 2003 operating system includes a DHCP Server service, which is an optional networking component. All Windows-based clients include the DHCP client as part of TCP/IP, including Windows Server 2003, Microsoft Windows XP, Windows 2000, Windows NT 4.0, Windows Millennium Edition (Windows Me), and Windows 98. Benefits of DHCP In Windows Server 2003, the DHCP Server service provides the following benefits:
Reliable IP address configuration. DHCP minimizes configuration errors caused by manual IP address configuration, such as typographical errors, or address conflicts caused by the assignment of an IP address to more than one computer at the same time. Reduced network administration. DHCP includes the following features to reduce network administration: o Centralized and automated TCP/IP configuration. o The ability to define TCP/IP configurations from a central location. o The ability to assign a full range of additional TCP/IP configuration values by means of DHCP options. o The efficient handling of IP address changes for clients that must be updated frequently, such as those for portable computers that move to different locations on a wireless network. o The forwarding of initial DHCP messages by using a DHCP relay agent, thus eliminating the need to have a DHCP server on every subnet.
Why use DHCP Every device on a TCP/IP-based network must have a unique unicast IP address to access the network and its resources. Without DHCP, IP addresses must be configured manually for new computers or computers that are moved from one subnet to another, and manually reclaimed for computers that are removed from the network. DHCP enables this entire process to be automated and managed centrally. The DHCP server maintains a pool of IP addresses and leases an address to any DHCP-enabled client when it starts up on the network. Because the IP addresses are dynamic (leased) rather than static (permanently assigned), addresses no longer in use are automatically returned to the pool for reallocation.
The network administrator establishes DHCP servers that maintain TCP/IP configuration information and provide address configuration to DHCP-enabled clients in the form of a lease offer. The DHCP server stores the configuration information in a database, which includes:
Valid TCP/IP configuration parameters for all clients on the network. Valid IP addresses, maintained in a pool for assignment to clients, as well as excluded addresses. Reserved IP addresses associated with particular DHCP clients. This allows consistent assignment of a single IP address to a single DHCP client. The lease duration, or the length of time for which the IP address can be used before a lease renewal is required.
A DHCP-enabled client, upon accepting a lease offer, receives:
A valid IP address for the subnet to which it is connecting. Requested DHCP options, which are additional parameters that a DHCP server is configured to assign to clients. Some examples of DHCP options are Router (default gateway), DNS Servers, and DNS Domain Name.
13. Types of classes in sub-netting along with their range. Calculate those ranges numerically/how do you get the range of these classes. Explanation: An IP address is the unique numerical address of a device in a computer network that uses Internet Protocol for communication. The IP addresses allow you to pinpoint a particular device from the billions of devices on the Internet. To send you a letter, someone needs your mailing address. In the same sense, one computer needs the IP address of another computer to communicate with it. An IP address consists of four numbers; each can contain one to three digits. These numbers are separated with a single dot (.). These four numbers can range from 0 to 255. The classes of IPv4 addresses The different classes of the IPv4 address are the following: 1) Class A address 2) Class B address 3) Class C address 4) Class D address 5) Class E address Class A Address The first bit of the first octet is always set to zero. So, the first octet ranges from 1 – 127. The class A address only include IP starting from 1.x.x.x to 126.x.x.x. The IP range 127.x.x.x is reserved for loop back IP addresses. The default subnet mask for class A IP address is 255.0.0.0. This means it can have 126 networks (2 7-2) and 16777214 hosts (224-2). Class A IP address format is thus: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH.
Class B Address Here the first two bits are set to zero. Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet mask for Class B is 255.255.x.x. Class B has 16384 (2 14) Network addresses and 65534 (216-2) Host addresses. Class B IP address format is: 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH Class C Address The first octet of this class has its first 3 bits set to 110. Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet mask for Class C is 255.255.255.x. Class C gives 2097152 (2 21) Network addresses and 254 (2 8-2) Host addresses. Class C IP address format is: 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH Class D Address The first four bits of the first octet in class D IP address are set to 1110. Class D has IP address rage from 224.0.0.0 to 239.255.255.255. Class D is reserved for Multicasting. In multicasting data is not intended for a particular host, but multiple ones. That is why there is no need to extract host address from the class D IP addresses. The Class D does not have any subnet mask. Class E Address The class E IP addresses are reserved for experimental purpose only for R&D or study. IP addresses in the class E ranges from 240.0.0.0 to 255.255.255.254. This class too is not equipped with any subnet mask.
Drive Name: NINE LEAPS Book Index: 118-(C) TECHNICAL 1. Write a program of factorial. Answer: #include using namespace std; int main() { unsigned int n; unsigned long long factorial = 1; cout << "Enter a positive integer: "; cin >> n; for(int i = 1; i <=n; ++i) { factorial *= i; }
cout << "Factorial of " << n << " = " << factorial; return 0; } Output Enter a positive integer: 12 Factorial of 12 = 479001600 2. Write a program of Fibonacci series. Answer: #include using namespace std; main() { int n, c, first = 0, second = 1, next; cout << "Enter the number of terms of Fibonacci series you want" << endl; cin >> n; cout << "First " << n << " terms of Fibonacci series are :- " << endl; for ( c = 0 ; c < n ; c++ ) { if ( c <= 1 ) next = c; else { next = first + second; first = second; second = next; } cout << next << endl; } return 0; } 3. Write a program for Merge sort program Answer: /* C program for Merge Sort */ #include<stdlib.h> #include<stdio.h> // Merges two subarrays of arr[]. // First subarray is arr[l..m] // Second subarray is arr[m+1..r] void merge(int arr[], int l, int m, int r) { int i, j, k;
int n1 = m - l + 1; int n2 = r - m; /* create temp arrays */ int L[n1], R[n2]; /* Copy data to temp arrays L[] and R[] */ for (i = 0; i < n1; i++) L[i] = arr[l + i]; for (j = 0; j < n2; j++) R[j] = arr[m + 1+ j]; /* Merge the temp arrays back into arr[l..r]*/ i = 0; // Initial index of first subarray j = 0; // Initial index of second subarray k = l; // Initial index of merged subarray while (i < n1 && j < n2) { if (L[i] <= R[j]) { arr[k] = L[i]; i++; } else { arr[k] = R[j]; j++; } k++; } /* Copy the remaining elements of L[], if there are any */ while (i < n1) { arr[k] = L[i]; i++; k++; } /* Copy the remaining elements of R[], if there are any */ while (j < n2) { arr[k] = R[j]; j++; k++; } } /* l is for left index and r is right index of the sub-array of arr to be sorted */
void mergeSort(int arr[], int l, int r) { if (l < r) { // Same as (l+r)/2, but avoids overflow for // large l and h int m = l+(r-l)/2; // Sort first and second halves mergeSort(arr, l, m); mergeSort(arr, m+1, r); merge(arr, l, m, r); } } /* UTILITY FUNCTIONS */ /* Function to print an array */ void printArray(int A[], int size) { int i; for (i=0; i < size; i++) printf("%d ", A[i]); printf("\n"); } /* Driver program to test above functions */ int main() { int arr[] = {12, 11, 13, 5, 6, 7}; int arr_size = sizeof(arr)/sizeof(arr[0]); printf("Given array is \n"); printArray(arr, arr_size); mergeSort(arr, 0, arr_size - 1); printf("\nSorted array is \n"); printArray(arr, arr_size); return 0; } Output: Given array is 12 11 13 5 6 7 Sorted array is 5 6 7 11 12 13 4. Explain arrays. Answer:
An array is a collection of data that holds fixed number of values of same type. For example: if you want to store marks of 100 students, you can create an array for it. float marks[100]; The size and type of arrays cannot be changed after its declaration. Arrays are of two types: One-dimensional arrays Multidimensional arrays (will be discussed in next chapter) How to declare an array in C? data_type array_name[array_size]; For example, float mark[5]; Here, we declared an array, mark, of floating-point type and size 5. Meaning, it can hold 5 floating-point values. Elements of an Array and How to access them? You can access elements of an array by indices. Suppose you declared an array mark as above. The first element is mark[0], second element is mark[1] and so on. C Array declaration Few key notes: Arrays have 0 as the first index not 1. In this example, mark[0] If the size of an array is n, to access the last element, (n-1) index is used. In this example, mark[4] Suppose the starting address of mark[0] is 2120d. Then, the next address, a[1], will be 2124d, address of a[2] will be 2128d and so on. It's because the size of a float is 4 bytes. How to initialize an array in C programming? It's possible to initialize an array during declaration. For example, int mark[5] = {19, 10, 8, 17, 9}; Another method to initialize array during declaration: int mark[] = {19, 10, 8, 17, 9}; Initialize an array in C programming Here, mark[0] is equal to 19 mark[1] is equal to 10 mark[2] is equal to 8 mark[3] is equal to 17 mark[4] is equal to 9 How to insert and print array elements? int mark[5] = {19, 10, 8, 17, 9} // insert different value to third element
mark[3] = 9; // take input from the user and insert in third element scanf("%d", &mark[2]); // take input from the user and insert in (i+1)th element scanf("%d", &mark[i]); // print first element of an array printf("%d", mark[0]); // print ith element of an array printf("%d", mark[i-1]); Example: C Arrays // Program to find the average of n (n < 10) numbers using arrays #include <stdio.h> int main() { int marks[10], i, n, sum = 0, average; printf("Enter n: "); scanf("%d", &n); for(i=0; i
Basic features of Stack 1.
Stack is an ordered list of similar data type.
2.
Stack is a LIFO(Last in First out) structure or we can say FILO(First in Last out).
3. 4.
push() function is used to insert new elements into the Stack and pop() function is used to remove an element from the stack. Both insertion and removal are allowed at only one end of Stack called Top.
5.
Stack is said to be in Overflow state when it is completely full and is said to be in Underflow state if it is completely empty.
Applications of Stack The simplest application of a stack is to reverse a word. You push a given word to stack - letter by letter - and then pop letters from the stack. There are other uses also like: 1.
Parsing
2.
Expression Conversion(Infix to Postfix, Postfix to Prefix etc)
QUEUES: Queue is also an abstract data type or a linear data structure, just like stack data structure, in which the first element is inserted from one end called the REAR(also called tail), and the removal of existing element takes place from the other end called as FRONT(also called head). This makes queue as FIFO(First in First Out) data structure, which means that element inserted first will be removed first.
Which is exactly how queue system works in real world. If you go to a ticket counter to buy movie tickets, and are first in the queue, then you will be the first one to get the tickets. Right? Same is the case with Queue data structure. Data inserted first, will leave the queue first. The process to add an element into queue is called Enqueue and the process of removal of an element from queue is called Dequeue.
Basic features of Queue 1.
Like stack, queue is also an ordered list of elements of similar data types.
2.
Queue is a FIFO( First in First Out ) structure.
3.
Once a new element is inserted into the Queue, all the elements inserted before the new element in the queue must be removed, to remove the new element.
4.
peek( ) function is oftenly used to return the value of first element without de-queuing it.
Applications of Queue Queue, as the name suggests is used whenever we need to manage any group of objects in an order in which the first one coming in, also gets out first while the others wait for their turn, like in the following scenarios: 1.
Serving requests on a single shared resource, like a printer, CPU task scheduling etc.
2.
In real life scenario, Call Center phone systems uses Queues to hold people calling them in an order, until a service representative is free.
3.
Handling of interrupts in real-time systems. The interrupts are handled in the same order as they arrive i.e First come first served.
LINKED LISTS: Introduction to Linked Lists Linked List is a very commonly used linear data structure which consists of group of nodes in a sequence. Each node holds its own data and the address of the next node hence forming a chain like structure. Linked Lists are used to create trees and graphs.
Advantages of Linked Lists
They are a dynamic in nature which allocates the memory when required.
Insertion and deletion operations can be easily implemented.
Stacks and queues can be easily executed.
Linked List reduces the access time.
Disadvantages of Linked Lists
The memory is wasted as pointers require extra memory for storage.
No element can be accessed randomly; it has to access each node sequentially.
Reverse Traversing is difficult in linked list.
Applications of Linked Lists
Linked lists are used to implement stacks, queues, graphs, etc.
Linked lists let you insert elements at the beginning and end of the list.
In Linked Lists we don't need to know the size in advance.
Types of Linked Lists There are 3 different implementations of Linked List available, they are: 1.
Singly Linked List
2.
Doubly Linked List
3.
Circular Linked List
6. Explain SQL queries. Answer: Ambiguous question. There are many sql queries. 7. What are joins in DBMS explain with an example. Answer: Basic SQL Join Types There are four basic types of SQL joins: inner, left, right, and full. The easiest and most intuitive way to explain the difference between these four types is by using a Venn diagram, which shows all possible logical relations between data sets. Let’s say we have two sets of data in our relational database: table A and table B, with some sort of relation specified by primary and foreign keys. The result of joining these tables together can be visually represented by the following diagram:
The extent of the overlap, if any, is determined by how many records in Table A match the records in Table B. Depending on what subset of data we would like to select from the two tables, the four join types can be visualized by highlighting the corresponding sections of the Venn diagram:
Examples of SQL Join Types Let's use the tables we introduced in the “What is a SQL join?” section to show examples of these joins in action. The relationship between the two tables is specified by the customer_id key, which is the "primary key" in customers table and a "foreign key" in the orders table:
Note that (1) not every customer in our customers table has placed an order and (2) there are a few orders for which no customer record exists in our customers table. Inner Join Let’s say we wanted to get a list of those customers who placed an order and the details of the order they placed. This would be a perfect fit for an inner join, since an inner join returns records at the intersection of the two tables. select first_name, last_name, order_date, order_amount from customers c inner join orders o on c.customer_id = o.customer_id
Note that only George Washington, John Adams and Thomas Jefferson placed orders, with Thomas Jefferson placing two separate orders on 3/14/1760 and 9/03/1790. Left Join If we wanted to simply append information about orders to our customers table, regardless of whether a customer placed an order or not, we would use a left join. A left join returns all records from table A and any matching records from table B. select first_name, last_name, order_date, order_amount from customers c left join orders o on c.customer_id = o.customer_id
Note that since there were no matching records for James Madison and James Monroe in our orders table, the order_date and order_amount are NULL, which simply means there is no data for these fields. So why would this be useful? By simply adding a “where order_date is NULL” line to our SQL query, it returns a list of all customers who have not placed an order: select first_name, last_name, order_date, order_amount from customers c left join orders o on c.customer_id = o.customer_id where order_date is NULL
Right Join Right join is a mirror version of the left join and allows to get a list of all orders, appended with customer information. select first_name, last_name, order_date, order_amount from customers c right join orders o on c.customer_id = o.customer_id
Note that since there were no matching customer records for orders placed in 1795 and 1787, the first_name and last_name fields are NULL in the resulting set. Also note that the order in which the tables are joined is important. We are right joining the orders table to the customers table. If we were to right join the customers table to the orders table, the result would be the same as left joining the orders table to the customers table. Why is this useful? Simply adding a “where first_name is NULL” line to our SQL query returns a list of all orders for which we failed to record information about the customers who placed them: select first_name, last_name, order_date, order_amount from customers c right join orders o on c.customer_id = o.customer_id where first_name is NULL Full Join Finally, for a list of all records from both tables, we can use a full join. select first_name, last_name, order_date, order_amount from customers c full join orders o on c.customer_id = o.customer_id
8. What are the various advantages of using Java over any other language? Answer: Advantages of Java
Java offers higher cross- functionality and portability as programs written in one platform can run across desktops, mobiles, embedded systems.
Java is free, simple, object-oriented, distributed, supports multithreading and offers multimedia and network support.
Java is a mature language, therefore more stable and predictable. The Java Class Library enables crossplatform development.
Being highly popular at enterprise, embedded and network level, Java has a large active user community and support available.
Unlike C and C++, Java programs are compiled independent of platform in bytecodelanguage which allows the same program to run on any machine that has a JVM installed.
Java has powerful development tools like Eclipse SDK and NetBeans which have debugging capability and offer integrated development environment.
Increasing language diversity, evidenced by compatibility of Java with Scala, Groovy, JRuby, and Clojure.
Relatively seamless forward compatibility from one version to the next
9. Define the following concepts Abstraction : Data abstraction is one of the most essential and important feature of object oriented programming in C++. Abstraction means displaying only essential information and hiding the details. Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation. Consider a real life example of a man driving a car. The man only knows that pressing the accelerators will increase the speed of car or applying brakes will stop the car but he does not know about how on pressing accelerator the speed is actually increasing, he does not know about the inner mechanism of the car or the implementation of accelerator, brakes etc in the car. This is what abstraction is.
Encapsulation : In normal terms Encapsulation is defined as wrapping up of data and information under a single unit. In Object Oriented Programming, Encapsulation is defined as binding together the data and the functions that manipulates them. Consider a real life example of encapsulation, in a company there are different sections like the accounts section, finance section, sales section etc. The finance section handles all the financial transactions and keep records of all the data related to finance. Similarly the sales section handles all the sales related activities and keep records of all the sales. Now there may arise a situation when for some reason an official from finance section needs all the data about sales in a particular month. In this case, he is not allowed to directly access the data of sales section. He will first have to contact some other officer in the sales section and then request him to give the particular data. This is what encapsulation is.
Polymorphism: 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 a same time can have different characteristic. Like a man at a same time is a father, a husband, a employee. So a same person possesses have different behaviour in different situations. This is called polymorphism. Polymorphism is considered as one of the important features of Object Oriented Programming. In C++ polymorphism is mainly divided into two types: Compile time Polymorphism Runtime Polymorphism
Recursion: The process in which a function calls itself is known as recursion and the corresponding function is called the recursive function. The popular example to understand the recursion is factorial function. Factorial function: f(n) = n*f(n-1), base condition: if n<=1 then f(n) = 1. Don’t worry we wil discuss what is base condition and why it is important. In the following diagram. I have shown that how the factorial function is calling itself until the function reaches to the base condition.
10. What is Binary Search Tree? Answer: Binary Search Tree is a node-based binary tree data structure which has the following properties: The left subtree of a node contains only nodes with keys lesser than the node’s key. The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right subtree each must also be a binary search tree.
11. If you Answer: Not a Technical Question.
Driver Name: WIPRO Book Index: 125-(C)
THECNICLA INTERVIEW QUESTIONS 1. How database can be connected in C language? Ans: #include<stdio.h> #include<SQLAPI.h> // main SQLAPI++ header int main(int argc, char* argv[]) { // create connection object to connect to database SAConnection con; try { // connect to database // in this example, it is Oracle, // but can also be Sybase, Informix, DB2 // SQLServer, InterBase, SQLBase and ODBC con.Connect ("test", // database name "tester", // user name "tester", // password SA_Oracle_Client); //Oracle Client printf("We are connected!\n"); // Disconnect is optional
don’t know about particular coding, what will you do?
// autodisconnect will occur in destructor if needed con.Disconnect(); printf("We are disconnected!\n"); } catch(SAException & x) { // SAConnection::Rollback() // can also throw an exception // (if a network error for example), // we will be ready try { // on error rollback changes con.Rollback (); } catch(SAException &) { } // print error message printf("%s\n", (const char*)x.ErrText()); } return 0; }
2. Explain your project in detail. Ans: 3. int n=4, n=n>>2, if given is the code, What will be the output Ans: output will be 1 4. What is Database normalization? Ans: Database normalization is the process of restructuring a relational database in accordance with a series of socalled normal forms in order to reduce data redundancy and improve data integrity. It was first proposed by Edgar F. Codd as an integral part of his relational model. 5. What are the types of pointers in Java? Ans: We use reference in Java. Reference: A reference is a variable that refers to something else and can be used as an alias for that something else. Pointer: A pointer is a variable that stores a memory address, for the purpose of acting as an alias to what is stored at that address. So, a pointer is a reference, but a reference is not necessarily a pointer. Pointers are a particular implementation of the concept of a reference, and the term tends to be used only for languages that give you direct access to the memory address. 6. What is jdbc function in Java? Ans: The JDBC API is a Java API that can access any kind of tabular data, especially data stored in a Relational Database. JDBC helps you to write Java applications that manage these three programming activities: Connect to a data source, like a database. Send queries and update statements to the database. 7. Print a value without using printf in C language? Ans: #include<stdio.h> int main(){ switch (printf("Chandigarh" )) { } } 8. Divide a number without using /. Ans: #include using namespace std; // Function to divide a by b and // return floor value it int divide(int dividend, int divisor) { // Calculate sign of divisor i.e., // sign will be negative only iff // either one of them is negative // otherwise it will be positive int sign = ((dividend < 0) ^ (divisor < 0)) ? -1 : 1; // Update both divisor and // dividend positive dividend = abs(dividend);
divisor = abs(divisor); // Initialize the quotient int quotient = 0; while (dividend >= divisor) { dividend -= divisor; ++quotient; } return sign * quotient; } // Driver code int main() { int a = 10, b = 3; cout << divide(a, b) <<"\n"; a = 43, b = -8; cout << divide(a, b); return 0; } 9. Write a program where the comparison between c++ and python can be drawn. Ans:C++ #include using namespace std; // Function to divide a by b and // return floor value it int divide(int dividend, int divisor) { // Calculate sign of divisor i.e., // sign will be negative only iff // either one of them is negative // otherwise it will be positive int sign = ((dividend < 0) ^ (divisor < 0)) ? -1 : 1; // Update both divisor and // dividend positive dividend = abs(dividend); divisor = abs(divisor); // Initialize the quotient int quotient = 0; while (dividend >= divisor) { dividend -= divisor; ++quotient; } return sign * quotient;
} // Driver code int main() { int a = 10, b = 3; cout << divide(a, b) <<"\n"; a = 43, b = -8; cout << divide(a, b); return 0; } Python: def divide(dividend, divisor): # Calculate sign of divisor i.e., # sign will be negative only iff # either one of them is negative # otherwise it will be positive sign = -1 if ((dividend < 0) ^ (divisor < 0)) else 1 # Update both divisor and # dividend positive dividend = abs(dividend) divisor = abs(divisor) # Initialize the quotient quotient = 0 while (dividend >= divisor): dividend -= divisor quotient += 1 return sign * quotient # Driver code a = 10 b=3 print(divide(a, b)) a = 43 b = -8 print(divide(a, b)) 10. What are DDL and DML commands? Ans: DDL:-CREATE, ALTER, DROP, TRUNCATE AND COMMENT and RENAME, etc. DML:-SELECT, INSERT, UPDATE, DELETE, MERGE, CALL, etc. Commands which Define the Structures or object are all DDL . Also DDL commands are auto- commit , they are transaction in themselves. 11. What are transactions in DBMS?
Ans: A transaction is a single logical unit of work which accesses and possibly modifies the contents of a database. Transactions access data using read and write operations. In order to maintain consistency in a database, before and after transaction, certain properties are followed. 12. How can we print anything in java other than using SOPL? Ans:import java.io.*; public class PrintOutTest { public static void main(String args[]) throws IOException { BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FileDescriptor.out), "ASCII"), 512); out.write("test string"); out.write('\n'); out.flush(); } } 13. What is big data? Explain its applications Ans: Big data usually includes data sets with sizes beyond the ability of commonly used software tools to capture, curate, manage, and process data within a tolerable elapsed time. Big data philosophy encompasses unstructured, semi-structured and structured data, however the main focus is on unstructured data. Some of the industries propelled by big data analytics are – Public Sector Services. Healthcare contributions. Learning Services. Insurance Services. Industrialized and Natural Resources. Transportation Services. Banking Sectors and Fraud Detection 14. Explain TCP/IP protocol. Ans: Transmission Control Protocol/Internet Protocol (TCP/IP) is the language a computer uses to access the internet. It consists of a suite of protocols designed to establish a network of networks to provide a host with access to the internet.
Drive Name: Hashedin Technologies Book Index: 128-(C) Technical interview
Find subsequence in a given array. Solution: // C++ program to print distinct subset sums of // a given array. #include using namespace std; // sum denotes the current sum of the subset // currindex denotes the index we have reached in // the given array void distSumRec(int arr[], int n, int sum, int currindex, unordered_set &s) { if (currindex > n) return; if (currindex == n) { s.insert(sum); return; } distSumRec(arr, n, sum + arr[currindex], currindex+1, s); distSumRec(arr, n, sum, currindex+1, s); } // This function mainly calls recursive function // distSumRec() to generate distinct sum subsets. // And finally prints the generated subsets. void printDistSum(int arr[], int n) { unordered_set s; distSumRec(arr, n, 0, 0, s); // Print the result for (auto i=s.begin(); i!=s.end(); i++) cout << *i << " "; } // Driver code int main() { int arr[] = {2, 3, 4, 5, 6}; int n = sizeof(arr)/sizeof(arr[0]); printDistSum(arr, n);
return 0; }
Write a program for Fibonacci series. Solution: /* Fibonacci series program in C language */ #include <stdio.h> int main() { int n, first = 0, second = 1, next, c; printf("Enter the number of terms\n"); scanf("%d", &n); printf("First %d terms of Fibonacci series are:\n", n); for (c = 0; c < n; c++) { if (c <= 1) next = c; else { next = first + second; first = second; second = next; } printf("%d\n", next); } return 0; }
What are arrays and strings? Ans: Strings are similar to arrays with just a few differences. Usually, the array size is fixed, while strings can have a variable number of elements. Arrays can contain any data type (char short int even other arrays) while strings are usually ASCII characters terminated with a NULL (0) character.
Write a code to reverse a linked list. Solution: // Iterative C++ program to reverse // a linked list #include using namespace std; /* Link list node */ struct Node
{ int data; struct Node* next; Node (int data) { this->data = data; next = NULL; } }; struct LinkedList { Node *head; LinkedList() { head = NULL; } /* Function to reverse the linked list */ void reverse() { // Initialize current, previous and // next pointers Node *current = head; Node *prev = NULL, *next = NULL; while (current != NULL) { // Store next next = current->next; // Reverse current node's pointer current->next = prev; // Move pointers one position ahead. prev = current; current = next; } head = prev; } /* Function to print linked list */ void print() { struct Node *temp = head; while (temp != NULL) { cout << temp->data << " "; temp = temp->next; }
} void push(int data) { Node *temp = new Node(data); temp->next = head; head = temp; } }; /* Driver program to test above function*/ int main() { /* Start with the empty list */ LinkedList ll; ll.push(20); ll.push(4); ll.push(15); ll.push(85); cout << "Given linked list\n"; ll.print(); ll.reverse(); cout << "\nReversed Linked list \n"; ll.print(); return 0; }
What is double pointer? Ans: a pointer points to a location in memory and thus used to store address of variables. So, when we define a pointer to pointer. The first pointer is used to store the address of second pointer. That is why they are also known as double pointers.
What is recursion? Ans: Recursion is a method of solving problems that involves breaking a problem down into smaller and smaller subproblems until you get to a small enough problem that it can be solved trivially. Usually recursion involves a function calling itself. While it may not seem like much on the surface, recursion allows us to write elegant solutions to problems that may otherwise be very difficult to program.
Write a program to find repeated element in array. Solution: // C++ program to find the only repeating element in an // array of size n and elements from range 1 to n-1. #include using namespace std; // Returns index of second appearance of a repeating element // The function assumes that array elements are in range from // 1 to n-1. int findRepeatingElement(int arr[], int low, int high) { // low = 0 , high = n-1; if (low > high) return -1; int mid = (low + high) / 2; // Check if the mid element is the repeating one if (arr[mid] != mid + 1) { if (mid > 0 && arr[mid]==arr[mid-1]) return mid; // If mid element is not at its position that means // the repeated element is in left return findRepeatingElement(arr, low, mid-1); } // If mid is at proper position then repeated one is in // right. return findRepeatingElement(arr, mid+1, high); } // Driver code int main() { int arr[] = {1, 2, 3, 3, 4, 5}; int n = sizeof(arr) / sizeof(arr[0]); int index = findRepeatingElement(arr, 0, n-1); if (index != -1) cout << arr[index]; return 0; }
Write program for a tic-tok game. Solution: // A C++ Program to play tic-tac-toe #include using namespace std; #define COMPUTER 1 #define HUMAN 2 #define SIDE 3 // Length of the board // Computer will move with 'O' // and human with 'X' #define COMPUTERMOVE 'O' #define HUMANMOVE 'X' // A function to show the current board status void showBoard(char board[][SIDE]) { printf("\n\n"); printf("\t\t\t %c | %c | %c \n", board[0][0], board[0][1], board[0][2]); printf("\t\t\t--------------\n"); printf("\t\t\t %c | %c | %c \n", board[1][0], board[1][1], board[1][2]); printf("\t\t\t--------------\n"); printf("\t\t\t %c | %c | %c \n\n", board[2][0], board[2][1], board[2][2]); return; } // A function to show the instructions void showInstructions() { printf("\t\t\t Tic-Tac-Toe\n\n"); printf("Choose a cell numbered from 1 to 9 as below" " and play\n\n"); printf("\t\t\t 1 | 2 | 3 \n"); printf("\t\t\t--------------\n"); printf("\t\t\t 4 | 5 | 6 \n"); printf("\t\t\t--------------\n"); printf("\t\t\t 7 | 8 | 9 \n\n"); printf("-\t-\t-\t-\t-\t-\t-\t-\t-\t-\n\n"); return; }
// A function to initialise the game void initialise(char board[][SIDE], int moves[]) { // Initiate the random number generator so that // the same configuration doesn't arises srand(time(NULL)); // Initially the board is empty for (int i=0; i<SIDE; i++) { for (int j=0; j<SIDE; j++) board[i][j] = ' '; } // Fill the moves with numbers for (int i=0; i<SIDE*SIDE; i++) moves[i] = i; // randomise the moves random_shuffle(moves, moves + SIDE*SIDE); return; } // A function to declare the winner of the game void declareWinner(int whoseTurn) { if (whoseTurn == COMPUTER) printf("COMPUTER has won\n"); else printf("HUMAN has won\n"); return; } // A function that returns true if any of the row // is crossed with the same player's move bool rowCrossed(char board[][SIDE]) { for (int i=0; i<SIDE; i++) { if (board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][0] != ' ') return (true); } return(false); } // A function that returns true if any of the column // is crossed with the same player's move
bool columnCrossed(char board[][SIDE]) { for (int i=0; i<SIDE; i++) { if (board[0][i] == board[1][i] && board[1][i] == board[2][i] && board[0][i] != ' ') return (true); } return(false); } // A function that returns true if any of the diagonal // is crossed with the same player's move bool diagonalCrossed(char board[][SIDE]) { if (board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[0][0] != ' ') return(true); if (board[0][2] == board[1][1] && board[1][1] == board[2][0] && board[0][2] != ' ') return(true); return(false); } // A function that returns true if the game is over // else it returns a false bool gameOver(char board[][SIDE]) { return(rowCrossed(board) || columnCrossed(board) || diagonalCrossed(board) ); } // A function to play Tic-Tac-Toe void playTicTacToe(int whoseTurn) { // A 3*3 Tic-Tac-Toe board for playing char board[SIDE][SIDE]; int moves[SIDE*SIDE]; // Initialise the game initialise(board, moves); // Show the instructions before playing showInstructions(); int moveIndex = 0, x, y;
// Keep playing till the game is over or it is a draw while (gameOver(board) == false && moveIndex != SIDE*SIDE) { if (whoseTurn == COMPUTER) { x = moves[moveIndex] / SIDE; y = moves[moveIndex] % SIDE; board[x][y] = COMPUTERMOVE; printf("COMPUTER has put a %c in cell %d\n", COMPUTERMOVE, moves[moveIndex]+1); showBoard(board); moveIndex ++; whoseTurn = HUMAN; } else if (whoseTurn == HUMAN) { x = moves[moveIndex] / SIDE; y = moves[moveIndex] % SIDE; board[x][y] = HUMANMOVE; printf ("HUMAN has put a %c in cell %d\n", HUMANMOVE, moves[moveIndex]+1); showBoard(board); moveIndex ++; whoseTurn = COMPUTER; } } // If the game has drawn if (gameOver(board) == false && moveIndex == SIDE * SIDE) printf("It's a draw\n"); else { // Toggling the user to declare the actual // winner if (whoseTurn == COMPUTER) whoseTurn = HUMAN; else if (whoseTurn == HUMAN) whoseTurn = COMPUTER; // Declare the winner declareWinner(whoseTurn); } return; } // Driver program int main() {
// Let us play the game with COMPUTER starting first playTicTacToe(COMPUTER); return (0); }
What is DML compiler? Ans: A data manipulation language (DML) is a family of syntax elements similar to a computer programming language used for selecting, inserting, deleting and updating data in a database. Performing read-only queries of data is sometimes also considered a component of DML. A popular data manipulation language is that of Structured Query Language (SQL), which is used to retrieve and manipulate data in a relational database.[1] Other forms of DML are those used by IMS/DLI, CODASYL databases, such as IDMS and others.
Drive Name: MIND TREE
Book Index: 132-(C)
TECHNICAL INTERVEIW 1. What are Deadlocks? Ans: A deadlock is a situation in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function. The earliest computer operating systems ran only one program at a time. All of the resources of the system were available to this one program. Later, operating systems ran multiple programs at once, interleaving them. Programs were required to specify in advance what resources they needed so that they could avoid conflicts with other programs running at the same time. Eventually some operating systems offered dynamic allocation of resources. Programs could request further allocations of resources after they had begun running. This led to the problem of the deadlock 2. What is Bubble Sorting? Ans: Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison-based algorithm in which each pair of adjacent elements is compared and the elements are swapped if they are not in order. This algorithm is not suitable for large data sets as its average and worst case complexity are of Ο(n2) where n is the number of items. 3. What is Programming? Ans: A programming language is a formal language, which comprises a set of instructions used to produce various kinds of output. Programming languages are used to create programs that implement specific algorithms. Most programming languages consist of instructions for computers, although there are programmable machines that use a limited set of specific instructions, rather than the general programming languages of modern computers. 4. What is Recursion? Ans: The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive function. Using recursive algorithm, certain problems can be solved quite easily. Examples of such problems are Towers of Hanoi (TOH), Inorder/Preorder/Postorder Tree Traversals, DFS of Graph, etc. In recursive program, the solution to base case is provided and solution of bigger problem is expressed in terms of smaller problems. int fact(int n) { if (n < = 1) // base case return 1; else return n*fact(n-1); }
In the above example, base case for n < = 1 is defined and larger value of number can be solved by converting to smaller one till base case is reached. 5. What is Data Base? Ans: A database is a collection of information that is organized so that it can be easily accessed, managed and updated. Data is organized into rows, columns and tables, and it is indexed to make it easier to find relevant information. Data gets updated, expanded and deleted as new information is added. Databases process workloads to create and update themselves, querying the data they contain and running applications against it. 6. What is round robin? Ans: Round-robin (RR) is one of the algorithms employed by process and network schedulers in computing. As the term is generally used, time slices (also known as time quanta) are assigned to each process in equal portions and in circular order, handling all processes without priority (also known as cyclic executive). 7. What do you mean by scheduling numerical? Ans: The process scheduling is the activity of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy. 8. What is segmentation (os) Programming? Ans: Segmentation is also a memory management scheme. It supports the user’s view of the memory. The process is divided into the variable size segments and loaded to the logical memory address space. The logical address space is the collection of variable size segments. Each segment has its name and length. For the execution, the segments from logical memory space are loaded to the physical memory space.
The address specified by the user contain two quantities the segment name and the Offset. The segments are numbered and referred by the segment numberinstead of segment name. This segment number is used as an index in thesegment table, and offset value decides the length or limit of the segment. The segment number and the offset together combinely generates the address of the segment in the physical memory space.
9. Explain Data base connectivity in detail? Ans: Database Connectivity is an application programming interface (API) for the programming language Java, which defines how a client may access a database. It is a Java-based data access technology used for Java database connectivity. It is part of the Java Standard Edition platform, from Oracle Corporation. It provides methods to query and update data in a database, and is oriented towards relational databases. A JDBC-toODBC bridge enables connections to any ODBC-accessible data source in the Java virtual machine (JVM) host environment. 10. What is Subnet masking? Ans: A subnet mask is a number that defines a range of IP addresses that can be used in a network. (It is not something you wear on your head to keep subnets out.) Subnet masks are used to designate subnetworks, or subnets, which are typically local networks LANs that are connected to the Internet. Systems within the same subnet can communicate directly with each other, while systems on different subnets must communicate through a router. Therefore, subnetworks can be used to partition multiple networks and limit the traffic between them. 11. What do you mean by Topologies? Ans: A network topology is the pattern in which nodes (i.e., computers, printers, routers or other devices) are connected to a local area network (LAN) or other network via links (e.g., twisted pair copper wire cable or optical fiber cable). Thereare four principal topologies used in LANs: bus, ring, star and mesh. 12. Explain the details of your Major project? Ans: Based on Student’s feedback 13. 2D array program? Ans: #include<stdio.h> int main(){ /* 2D array declaration*/ int disp[2][3]; /*Counter variables for the loop*/ int i, j; for(i=0; i<2; i++) { for(j=0;j<3;j++) { printf("Enter value for disp[%d][%d]:", i, j); scanf("%d", &disp[i][j]); } } //Displaying array elements printf("Two Dimensional array elements:\n"); for(i=0; i<2; i++) { for(j=0;j<3;j++) { printf("%d ", disp[i][j]); if(j==2){ printf("\n"); } } } return 0; } Output:
Enter value for disp[0][0]:1 Enter value for disp[0][1]:2 Enter value for disp[0][2]:3 Enter value for disp[1][0]:4 Enter value for disp[1][1]:5 Enter value for disp[1][2]:6 Two Dimensional array elements: 123 456 14. Explain Joins in RDBMS? Ans: Let’s say we have two sets of data in our relational database: table A and table B, with some sort of relation specified by primary and foreign keys. The result of joining these tables together can be visually represented by the following diagram:
The extent of the overlap, if any, is determined by how many records in Table A match the records in Table B. Depending on what subset of data we would like to select from the two tables, the four join types can be visualized by highlighting the corresponding sections of the Venn diagram:
15. Explain Heap sorting? Ans: 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 remaining element. 16. What is Scope of variable? Ans: Scope of variable is one of the important concept of Oops programming. Scope of variable can be defined as lifetime of that variable. There are two type of scopes of a variable 1.global 2.local A variable is said to have global scope if they can be used anywhere but within the same class in which it is declared. An instance variables are the variables that have global scope. The variable that are declared inside the method are said to have a local scope .lets consider an example-
class Addition { int a=10; // a and b are the instance variables and they have a global scopethey can be used anywhere but within the class only in which they are declared . When the control move out of the class their scope ends. int b=20; void add() { int c=a+b; //c is a local variable because it is declared inside the method. When scope go out of the method its scope ends. System.out.println("c"); } public static void main( String[] args) { Addition ad=new Addition(); } } 17. What is difference between arguments and parameters? Ans: The parameters of a function/method describe to you the values that it uses to calculate its result. The arguments of a are the values assigned to these parameters during a particular call of the function/method. 18. What is difference between local and global variable? Ans: Kindly refer Question no. 16.
Company Name: - PE-2001 (Virtusa) Book Index: 145-(C) Technical MCQ Which of the following sorting methods sorts a given set of items that is already in sorted order or in reverse sorted order with equal speed? A. Selection Sort B. Quick Sort C. insertion sort D. Heap sort Answer A 1.
Explanation: Selection Sort Best case complexity is Ω(n^2) and worst case complexity is also same O(n^2). Best-case performance О(n2) comparisons, О(n) swaps Average performance О(n2) comparisons, О(n) swaps 2.
Which of the following statement is true? A. Except in case of VM shutdown, if a try block starts to execute, a corresponding finally block will always start to execute. B. A try statement must have at least one corresponding catch block. C. Multiple catch statements can catch the same class of exception more than once. D. Except in case of VM shutdown, if a try block starts to execute, a corresponding finally block must always run to completion. Answer: D Explanation: A is wrong. A try statement can exist without catch, but it must have a finally statement. B is wrong. A try statement executes a block. If a value is thrown and the try statement has one or more catch clauses that can catch it, then control will be transferred to the first such catch clause. If that catch block completes normally, then the try statement completes normally. C is wrong. Exceptions of type Error and RuntimeException do not have to be caught, only checked exceptions (java.lang.Exception) have to be caught. However, speaking of Exceptions, Exceptions do not have to be handled in the same method as the throw statement. They can be passed to another method. If you put a finally block after a try and its associated catch blocks, then once execution enters the try block, the code in that finally block will definitely be executed except in the following circumstances: An exception arising in the finally block itself. The death of the thread. The use of System.exit() Turning off the power to the CPU. I suppose the last three could be classified as VM shutdown.
Which of the following is the measurement of degree to which a component, system or process meets specified requirements and/or user/customer needs and expectations. A. Software Product B. Software Process C. Software Quality D. Quantity Answer: c 3.
Explanation:
quality: The degree to which a component, system or process meets specified requirements and/or user/customer needs and expectations. software quality: The totality of functionality and features of a software product that bear on its ability to satisfy stated or implied needs. 4.
Which of the following model remains operative until the software is retired? A. Water fall B. Spiral C. Incremental D. All of the above Answer: C Explanation: The spiral model is based on continuous refinement of key products for requirements definition and analysis, system and software design, and implementation (the code). At each iteration around the cycle, the products are extensions of an earlier product. This model uses many of the same phases as the waterfall model, in essentially the same order, separated by planning, risk assessment, and the building of prototypes and simulations
5.
Which of the following sorting algorithm has the worst time complexity of nlog(n)? A. Heap sort B. Selection Sort C. Quick Sort D. Insertion sort Answer:A Explanation:Heapsort has O(n) time when all elements are the same. Heapify takes O(n) time and then removing elements from the heap is O(1) time for each of the n elements. The run time grows to O(nlog(n)) if all elements must be distinct.
6.
The information about an array that is used in a program will be stored in A. symbol table B. system table C. dope vector D. activation record Answer:C Explanation: Dope vector is a data structure that is used by compilers to store some metadata about the array like its total size, the size of one unit also called stride of the array, etc. These are used to describe arrays and other similar structures that store multiple values of one datatype as a complete block of memory. It can also describe structures that contain arrays and similar structures as its component. Dope vectors help compilers to access the arrays with ease. Different checks that are implemented by compiler like Out of Bound check,datatype check,etc. are all possible because of dope vector associated with the array.
Consider the following scenario: A company decides that it only wants to use the most popular names for its products. You have to give the number of employees against each unique first name. Which of the following four core interfaces is best-suited for implementing the above scenario? A. Map B. Set C. Queue D. List Answer:A Explanation: A Map is an object that maps keys to values. A map cannot contain duplicate keys: Each key can map to at most one value. 7.
8.
Web pages starts with which of the following tag? A. B. <TITLE> C. D.