Skip to main content

Common Interview Questions

Q1. Name of seven layers in Open System Interconnection model.
A. They are Application, Presentation, Session, Transport, Network, Data link, and Physical.
Q2. What is the time complexity of matrix multiplication?
void Mult_Matrix(matrix A, matrix B, matrix C)
int i, j, k;
for ( i = 1; i < N; i++)
for ( j = 1; j < N; j++ )
C[i][j] = 0;
for ( k = 0; k < N; k++ )
C[i][j] = A[i][j]*B[k][j];
A. The time comlexity of matrix mulitiplication is O(N^3)
Q3. What is the null pointer in C++ ?
A. The null pointer is a special C++ pointer value that can be used for any pointer that doesn’t pointer anywhere. It can be written as the constant NULL form stlib.h
Q4. What is the goal of the shortest distance algorithm ?
A. The goal is to completely fill the distance array so that for each vertex v, the value of distance[v] is the weight of the shortest path from start to v.
Q5. What is the difference between an abstract class and an interface?
An abstract class may have fields and some implemented methods.
An interface has no implementation; only constants and method declarations.
1. Describe how the DHCP lease is obtained. It’s a four-step process consisting of (a) IP request, (b) IP offer, © IP selection and (d) acknowledgement.
2. I can’t seem to access the Internet, don’t have any access to the corporate network and on ipconfig my address is 169.254.*.*. What happened? The 169.254.*.* netmask is assigned to Windows machines running 98/2000/XP if the DHCP server is not available. The name for the technology is APIPA (Automatic Private Internet Protocol Addressing).
3. We’ve installed a new Windows-based DHCP server, however, the users do not seem to be getting DHCP leases off of it. The server must be authorized first with the Active Directory.
4. How can you force the client to give up the dhcp lease if you have access to the client PC? ipconfig /release
5. What authentication options do Windows 2000 Servers have for remote clients? PAP, SPAP, CHAP, MS-CHAP and EAP.
6. What are the networking protocol options for the Windows clients if for some reason you do not want to use TCP/IP? NWLink (Novell), NetBEUI, AppleTalk (Apple).
7. What is data link layer in the OSI reference model responsible for? Data link layer is located above the physical layer, but below the network layer. Taking raw data bits and packaging them into frames. The network layer will be responsible for addressing the frames, while the physical layer is reponsible for retrieving and sending raw data bits.
8. What is binding order? The order by which the network protocols are used for client-server communications. The most frequently used protocols should be at the top.
9. How do cryptography-based keys ensure the validity of data transferred across the network? Each IP packet is assigned a checksum, so if the checksums do not match on both receiving and transmitting ends, the data was modified or corrupted.
10. Should we deploy IPSEC-based security or certificate-based security? They are really two different technologies. IPSec secures the TCP/IP communication and protects the integrity of the packets. Certificate-based security ensures the validity of authenticated clients and servers.
11. What is LMHOSTS file? It’s a file stored on a host machine that is used to resolve NetBIOS to specific IP addresses.
12. What’s the difference between forward lookup and reverse lookup in DNS? Forward lookup is name-to-address, the reverse lookup is address-to-name.
13. How can you recover a file encrypted using EFS? Use the domain recovery agent.
2.Describe the components of a typical test plan?
ans) this contains all the test strategy that follows through the project. it contains
1. what to be tested?
2. what not to be tested?
3. is the automation necessary for this?
4. if yes which automated tools is going to be used.
5. time schedules
6. Resource planning etc…
*Note: the i/p for the test plan is project plan.

· Testing: The process of executing a system with the intent of finding defects including test planning prior to the execution of the test cases.
· Quality Control: A set of activities designed to evaluate a developed working product.
· Quality Assurance: A set of activities designed to ensure that the development and/or maintenance process is adequate to ensure a system will meet its objectives.
The key difference to remember is that QA is interested in the process whereas testing and quality control are interested in the product. Having a testing component in your development process demonstrates a higher degree of quality (as in QA).

What is pure virtual function?
A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is one with an initializer of = 0 in its declaration.

class Base {
virtual void f(int) = 0;

In C++, what is the difference between method overloading and method overriding?
Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.

 In C, what is the difference between a static variable and global variable? A static variable declared outside of any function is accessible only to all the functions defined in the same file (as the static variable). However, a global variable can be accessed by any function (including the ones from different files).
 In C, why is the void pointer useful? When would you use it? The void pointer is useful becuase it is a generic pointer that any pointer can be cast into and back again without loss of information.
 What are the defining traits of an object-oriented language? The defining traits of an object-oriented langauge are:
· encapsulation
· inheritance
· polymorphism
4.Q: Can you be bale to identify between Straight- through and Cross- over cable wiring? and in what case do you use Straight- through and Cross-over? (Asked by Cisco system people)
A. Straight-through is type of wiring that is one to one connection Cross- over is type of wiring which those wires are got switched
We use Straight-through cable when we connect between NIC Adapter and Hub. Using Cross-over cable when connect between two NIC Adapters or sometime between two hubs.
Q: Write a program that ask for user input from 5 to 9 then calculate the average( Asked by Cisco system people) main()
int MAX=4;
int total =0;
int average=0;
int numb;
cout<<"Please enter your input from 5 to 9";
if((numb <5)&&(numb>9))
cout<<"please re type your input";
for(i=0;i<=MAX; i++)
total = total + numb;
average= total /MAX;
cout<<"The average number is"<return 0;
A+ and basic PC questions
 What are the basic expansion card types?
ISA and PCI, ISA can be used only on XT, AT and ATX boards. The industry now considers ISA obsolete.
 How do you clear CMOS password?
Since CMOS is a special chip with its own battery, the best way to clear out a CMOS chip is to disconnect it from its power supply.
 Where does the Real mode on the CPU come from?
The original 8086, which only had 1 MB of memory. This megabyte is split into low memory for IRQ tables, application memory and high memory.

 Where does CPU Enhanced mode originate from?
Intel’s 80386 was the first 32-bit processor, and since the company had to backward-support the 8086. All the modern Intel-based processors run in the Enhanced mode, capable of switching between Real mode (just like the real 8086) and Protected mode, which is the current mode of operation.
 Name the processor lines of two major manufacturers?
High-end: Intel - Pentium (II, III, 4), AMD - Athlon. Low-end: Intel - Celeron, AMD - Duron. 64-bit: Intel - Itanium 2, AMD - Opteron.
 What’s the difference between L1 and L2 cache?
Level 1 cache is internal to the chip, L2 is external.
 What’s the speed and device maximum specs for Firewire?
IEEE 1394 (Firewire) supports the maximum of 63 connected devices with speeds up to 400 Mbps.
 Where’s MBR located on the disk?
Main Boot Record is located in sector 0, track 0, head 0, cylinder 0 of the primary active partition.
 What’s the maximum hard drive size for FAT16-based Windows system?
2 GB.
 How many logical drives is it possible to fit onto a physical disk?
Maximum of 24 logical drives. The extended partition can only have 23 logical drives.
 WHat are * and ? when using them for wildcards in Windows? * -
any characters, arbitrary amoung, ? - single character.
 How does the browser know to go to a certain IP address when you enter a domain like
It searches through local DNS cache, if nothing is there, it queries the ISP’s DNS server.

if you start a pointer at the beginning and the end of the string and keep comparing characters while moving the pointers closer together, you can test if the string is the same forwards and backwards. notice that the pointers only have to travel to the middle, not all the way to the other end (to reduce redundancy).
bool isPalindrome( char* pStr )
if ( pStr == NULL )
return false;

char* pEnd = pStr;
while ( *pEnd != '\0' )


while(pEnd > pStr)
if ( *pEnd != *pStr )
return false;


return true;

How does one find a loop in a singly linked list in O(n) time using constant memory? you cannot modify the list in any way (and constant memory means the amount of memory required for the solution cannot be a function of n.)

solution: linked list
I first figured this out when I was asked the question in a Microsoft interview, so there's verification that one question in the book was from a real interview. The best part of this problem is that I actually needed to write the code out for it a little while ago to detect a bug.
One way to detect a loop is to iterate over the list with 2 pointers at the same time where one is iterating at double speed. If the 2 pointers are ever equal after they iterate once and before they both reach an end, there's a loop.
Now for another puzzle.. I think the next question I had to answer was something along the lines of "OK, How do you remove a loop in a linked list with the same constraints?" The latter question definitely seems harder, but in the sequence of questions I'd already answered for the interviewer, the solution was pretty obvious. I'll leave that solution to someone else today.
reverse a string - word by word aha:!!
a typical programming interview question is "reverse a string, in place". if you understand pointers, the solution is simple. even if you don't, it can be accomplished using array indices. i usually ask candidates this question first, so they get the algorithm in their head. then i play dirty by asking them to reverse the string word by word, in place. for example if our string is "the house is blue", the return value would be "blue is house the". the words are reversed, but the letters are still in order (within the word).
solution: reverse a string - word by word
problem: reverse "the house is blue", the answer should be "blue is house the". the words are reversed, but the letters are still in order (within the word).
solving the initial problem of just reversing a string can either be a huge help or a frustrating hinderance. most likely the first attempt will be to solve it the same way, by swapping letters at the front of the string with letters at the back, and then adding some logic to keep the words in order. this attempt will lead to confusion pretty quickly.
for example, if we start by figuring out that "the" is 3 letters long and then try to put the "t" from "the" where the "l" from "blue" is, we encounter a problem. where do we put the "l" from "blue"? hmm... well we could have also figured out how long "blue" was and that would tell us where to put the "l" at... but the "e" from "blue" needs to go into the space after "the". argh. its getting quite confusing. in fact, i would be delighted to even see a solution to this problem using this attack method. i don't think its impossible, but i think it is so complex that it's not worth pursuing.
here's a hint. remember before when we just reversed "the house is blue"? what happened?
initial: the house is blue
reverse: eulb si esuoh eht
look at the result for a minute. notice anything? if you still don't see it, try this.
initial: the house is blue
reverse: eulb si esuoh eht
wanted : blue is house the
the solution can be attained by first reversing the string normally, and then just reversing each word.
16-bit character set that assigns unique character codes to characters in a wide range of languages. Unlike ASCII, which defines 128 distinct characters typically represented in 8 bits, there are as many as 65,536 distinct Unicode characters that represent the unique characters used in many languages.
Why Unicode?
Everyone dealt with strings. In C, they are character arrays. Each character is 8 bits long and can store up to 256 values, of which some are control characters, some are letters, some are punctuation, and so on. Of those 256 characters, first 128 are standardized by ANSI, meaning they are always exactly the same. The first 128 characters contain control characters (0-31), arabic numbers, common punctuation, English alphabet in lower and upper cases, and some other stuff. The second 128 characters are not standardized and can mean different things depending on the codepage. For standard English codepage, they have some Greek letters, more punctuation like ellipsis, character-mode graphics symbols (Vertical and horizontal lines, etc), and other things. Non-English codepages store the English symbols in the first 128 characters (as specified by ANSI) and store their native alphabets in the second 128 characters. This leads to two problems:
· The Greek letters and character-mode graphics are thrown away to make room for native characters. As a result, text that uses these thrown out characters will not look correctly if for example a Cyrillic codepage is active.
· Some alphabets, such as Asian ones, have more letters than 128 slots can fit (remember you need separate slots for upper and lower case letters, too). For those layouts, it is physically impossible to store all letters in 256 bytes that a char provides.
As you see, a single 8-bit value is not enough for all languages. One solution is to use something called multi-byte character sets, where a character can take either one or two bytes. It is very hard to work with such character sets because you cannot just use indices to refer to, for example, letters of a string. You need to use special functions to advance forward and backward in a string that handles those multibyte characters. In short, the process is very painful.
What is Unicode?
Unicode is a 16-bit character set designed to address the limitations of 8-bit character sets and inconveniences of multibyte character sets. In Unicode, each character occupies two bytes, giving a possible total of 65536 values. Currently, parts of that 64k range are allocated to different alphabets, and there is still quite a bit of space left. All known languages can be fit in the 64k values, fixing the 8-bit range limitation. At the same time, each character has the same number of bytes (two), making it easy to work with Unicode strings. The old indexing and increment operators work as intended.
Types of Joins
See Also Tasks
When you join tables, the type of join that you create determines the rows that appear in the result set. You can create the following types of joins:
· Inner join A join that displays only the rows that have a match in both joined tables. (This is the default type of join in the Query Designer.) For example, you can join the titles and publishers tables to create a result set that shows the publisher name for each title. In an inner join, titles for which you do not have publisher information are not included in the result set, nor are publishers with no titles.
Note Columns containing NULL do not match any values when you are creating an inner join and are therefore excluded from the result set. Null values do not match other null values.
· Outer join A join that includes rows even if they do not have related rows in the joined table. You can create three variations of an outer join to specify the unmatched rows to be included:
· Left outer join All rows from the first-named table (the "left" table, which appears leftmost in the JOIN clause) are included. Unmatched rows in the right table do not appear. For example, the following SQL statement illustrates a left outer join between the titles and publishers tables to include all titles, even those you dont have publisher information for:
· SELECT titles.title_id, titles.title,
· publishers.pub_name
· FROM titles LEFT OUTER JOIN publishers ON
· titles.pub_id = publishers.pub_id
· Right outer join All rows in the second-named table (the "right" table, which appears rightmost in the JOIN clause) are included. Unmatched rows in the left table are not included. For example, a right outer join between the titles and publishers tables will include all publishers, even those who have no titles in the titles table.
· Full outer join All rows in all joined tables are included, whether they are matched or not. For example, a full outer join between titles and publishers shows all titles and all publishers, even those that have no match in the other table.
Note Some databases, such as Oracle, do not support full outer joins. For details, see Query Designer Considerations for Oracle Databases.
You can also create a self-join, which compares rows within the same table. For example, you can use a self-join to find all publishers that are in a specific city and have the same postal code. For details, see Creating Self-Joins.

Post a Comment

Popular posts from this blog

Compact and Repair an Access Database. Add Ref. to : AdoDb, Jro

< ?xml version="1.0" encoding="utf-8" ?>

using ADODB;
using JRO;
using System.Configuration;
using System.Data.OleDb;
using System.IO;

public class CompactAndRepairAccessDb : System.Windows.Forms.Form
private System.ComponentModel.Container components = null;
private JRO.JetEngine jro;
private System.Windows.Forms.Button btnConfirm;
private System.Windows.Forms.TextBox tbxOriginalDbSize;
private System.Windows.Forms.TextBox tbxCompactedDbSize;
private OleDbConnection cnn;

public CompactAndRepairAccessDb() {

FileInfo fi = new FileInfo( ConfigurationSettings.AppSettings["PathOriginal"] );
int s = Convert.ToInt32( fi.Length/1000 );
this.tbxOriginalDbSize.Text = s.ToString() + " kb";

private void btnConfirm_Click(object sender, System.EventArgs e) {
// First close all instances of the database

VBScript to Automate login into gmail

Dim IE
Dim crtScreen
Set IE = CreateObject("InternetExplorer.Application")
USERNAME = "saudaziz"

With IE
.navigate ""
End With

'wait a while until IE as finished to load
Do while IE.busy
set WshShell = WScript.CreateObject("WScript.Shell")
Do While UCase(IE.Document.readyState) <> "COMPLETE"
WScript.Sleep 100
set WshShell=nothing
IE.document.all.Item("Email").value = USERNAME
IE.document.all.Item("pASSWD").value =pASSWORD
Set IE = Nothing