Tuesday, June 25, 2013

Interview FAQ

#Configuring Normal-Range VLANs
Normal-range VLANs are VLANs with VLAN IDs 1 to 1005. If the switch is in VTP server or transparent mode, you can add, modify or remove configurations for VLANs 2 to 1001 in the VLAN database. (VLAN IDs 1 and 1002 to 1005 are automatically created and cannot be removed.)

Note: When the switch is in VTP transparent mode and the enhanced software image is installed, you can also create extended-range VLANs (VLANs with IDs from 1006 to 4094), but these VLANs are not saved in the VLAN database. See the "Configuring Extended-Range VLANs" section.

Configurations for VLAN IDs 1 to 1005 are written to the file vlan.dat (VLAN database), and you can display them by entering the show vlan privileged EXEC command. The vlan.dat file is stored in nonvolatile RAM (NVRAM).

Note: The VTP mode can change from client mode to transparent mode if the switch attempts to learn or pass a greater number of VLANs than it supports. Always check that the switches that run in client mode support the same number of VLANs that the switches in server mode send

STP does not implement any authentication and encryption to protect the exchange of BPDUs. Because of the lack of authentication, anyone can speak to a STP-enabled device. An attacker could very easily inject bogus BPDUs, triggering a topology recalculation. A forced change to the STP topology could lead to a denial of service condition, or leave the attacker as a man-in-the-middle. In addition, because BPDUs are not encrypted, it is fairly simple to intercept BPDUs in transit, revealing important topology information.

#VLAN Best Common Practices
VLAN hopping is an attack vector which provides a client with unauthorized access to other VLANs on a switch. This type of attack can be easily mitigated by applying the following best common practices:
•Always use a dedicated VLAN ID for all trunk ports
•Disable all unused ports and put them in an unused VLAN
•Do not use VLAN 1 for anything
•Configure all user-facing ports as non-trunking (DTP off)
•Explicitly configure trunking on infrastructure ports
•Use all tagged mode for the native VLAN on trunks and drop untagged frames
•Set the default port status to "disable"

#Different Native VLANs
This is a frequent configuration error. The native VLAN that is configured on each end of a 802.1Q trunk must be the same. Remember that a switch receiving a nontagged frame assigns it to the native VLAN of the trunk. If one end is configured for native VLAN 1 and the other to native VLAN 2, a frame that is sent in VLAN 1 on one side is received on VLAN 2 on the other. This results in the merge of VLAN 1 and 2. There is no reason that you would want that, and it may imply some connectivity issues in your network.

A Cisco device usually warns you of a native VLAN mismatch. See Step 1 of the section Set the Native VLAN for the kind of error messages that you get on the console in this case. Always check that the native VLAN is the same on the trunk configuration of your switches.
Note: The term extended range includes any VLAN from 1025 to 4094. The term default extended range includes all VLANs from 1025 to 4094. If you try to clear any VLAN in the range from 1025 to 4094, the VLAN becomes non-default extended range. The maximum number of trunks which pass non-default extended range is 64. This includes both inactive and active trunks.

#STP Conclusion
An important point to consider here is that a TCN does not start a STP recalculation. This fear comes from the fact that TCNs are often associated with unstable STP environments; TCNs are a consequence of this, not a cause. The TCN only has an impact on the aging time. It does not change the topology nor create a loop.

The number or the rate of topology changes is not an issue in itself. The problem is to know what the topology change means. A healthy network can experience a high rate of topology change. But, a topology change should ideally be related to a significant event in the network like a server that goes up or down or a link that transitions. This is achieved by enabling portfast on ports that go up and down as part of their normal operation.

#Tunnel Ports
Tunnel ports are used in 802.1Q tunneling to segregate the traffic of customers in a service provider network from other customers who appear to be on the same VLAN. You configure an asymmetric link from a tunnel port on a service provider edge switch to an 802.1Q trunk port on the customer switch. Packets entering the tunnel port on the edge switch, already 802.1Q-tagged with the customer VLANs, are encapsulated with another layer of 802.1Q tag (called the metro tag) containing a VLAN ID unique in the service provider network, for each customer. The double-tagged packets go through the service-provider network keeping the original customer VLANs separate from those of other customers. At the outbound interface, also a tunnel port, the metro tag is removed, and the original VLAN numbers from the customer network are retrieved.
Tunnel ports cannot be trunk ports or access ports and must belong to a VLAN unique for each customer.

#A switch virtual interface (SVI) represents a VLAN of switch ports as one interface to the routing or bridging function in the system. Only one SVI can be associated with a VLAN, but you need to configure an SVI for a VLAN only when you wish to route between VLANs, fallback-bridge nonroutable protocols between VLANs, or to provide IP host connectivity to the switch. By default, an SVI is created for the default VLAN (VLAN 1) to permit remote switch administration. Additional SVIs must be explicitly configured. In Layer 2 mode, SVIs provide IP host connectivity only to the system; in Layer 3 mode, you can configure routing across SVIs.
SVIs are created the first time that you enter the vlan interface configuration command for a VLAN interface. The VLAN corresponds to the VLAN tag associated with data frames on an ISL or 802.1Q encapsulated trunk or the VLAN ID configured for an access port. Configure a VLAN interface for each VLAN for which you want to route traffic, and assign it an IP address

#Mac address of RSTP
A bridge sends a BPDU frame using the unique MAC address of the port itself as a source address, and a destination address of the STP multicast address 01:80:C2:00:00:00.

#why rstp is faster than stp
1. RSTP uses proposal / Agreement instead of STP using timers.
2. All the STP tool kit (uplink fast, backbone fast, etc) are included in RSTP by default.
3. RSTP have simplified port roles.
4. The way BPDU's are flown / the way RSTP handles the topology change is quite different from STP.

#what is the use of i bit. more bit and master/slave bit in DBD

#whats the protocol used in dsl modem

#How will you install an application in linux

#What should be the ts steps if customer says he is not able to send his mail.
Isolate the data ie check the type of data you are sending whether it is supported or not.
Able to receive but not able to send : make sure that port 25 isn’t blocked in your network.
Able to send but not able to receive: make sure that mail server is enabled.
Is the problem with the server : check server cpu memory and BW utilization.
Check whether outgoing mails are blocked on port 25
Check whether issue is with your network /user or all are effected.

#How to test chat application.
Cover all the test scenarios.
The few test cases that I could come up with are:
1) The max limit of the text field
2) Client can connect to the Server
3) Server can connect to the Client
4) Client can send message
5) Client can receive message
6) Server can send message
7) Server can receive message
8) Server can accept connections from multiple clients
9)All the buttons are working or not
10) Execute these scenarios with different user roles e.g. admin user, guest user etc.
11) For web applications these scenarios should be tested on multiple browsers like IE, FF, Chrome, and Safari with versions approved by client.
12) Test with different screen resolutions like 1024 x 768, 1280 x 1024, etc.
13) Application should be tested on variety of displays like LCD, CRT, Notebooks, Tablets, and Mobile phones.
14) Test application on different platforms like Windows, Mac, Linux operating systems.

#Testcases on fire extinguisher
1. Extinguishers are in their designated places.
2. There are no obstructions to access or visibility.
3. Safety seals are not broken or missing.
4. There is no evidence of physical damage, corrosion, leakage or clogged nozzle.
5. Pressure gauge readings are in the proper range or position.
6. Operating instructions are legible and facing outward.
7. Fullness confirmed by weighing or lifting.
8. first aid kit, saftey glasses and medical supplies.

#Write a Test Cases on Fan
1. It should have a hook for hanging in the roof.
2. it should have minium three blades.
3. If should be moving once the electricty pass into it.
4. Speed of the fan should be controlled by the regulator.
5. It should be stop once the electric switch off.
6. The fan should run with minimum noise.
7. The blades should have proper distance from the ceiling.
8. The fan while in motion, should not vibrate.

#Test cases for Mobile Phone
1)Chek whether Battery is inserted into mobile properly
2)Chek Switch on/Switchoff of the Mobile
3)Insert the sim into the phone n chek
4)Add one user with name and phone number in Address book
5)Chek the Incoming call
6)chek the outgoing call
7)send/receive messages for that mobile
8)Chek all the numbers/Characters on the phone working fine by clicking on them..
9)Remove the user from phone book n chek removed properly with name and phone number
10)Chek whether Network working fine..
11)If its GPRS enabled chek for the connectivity.

#Testcases on chair:
1. Check whether the chair is very comfortable to take rest
2. Check whether the chair is available in your favourite colour
3. Check whether the chair is made up of plastic or wood
4. Check it has got wheels on bottom to move from one to other place
5. Check whether it has got some extra addins to stretch on back
6. Check whether it has got any seating adjustment to make height or low
7. Check whether the chair seat has got some air space to flow of air
8. Check whether the chair has got enough space to be seat with fat or thin people.
9. Check whether the chair is upto your price
10. Check whether the chair is very attractive
11. successfully check it is plastic r iron chair
12.successfully check it has two sides for putting hands

#What Is MPLS and Why do we need it?
Multi Protocol Label Switching (MPLS) in simple terms, which enables a Service Provider (SP) to offer scalable and internetworking solutions for its clients. In addition to scalability, MPLS offers Traffic Engineering (TE) and Quality of Service (QoS). While TE is more oriented towards SP, scalability and QoS features will benefit both SP and its

#card shuffling algorithm:
Check for algorithm with shortest execution time and degree of shuffleness.

#how to find a count of a particular word used in script.
grep -c "test" Nawraj

#grep FAQ
grep 'word' filename
grep 'word' file1 file2 file3
grep 'string1 string2'  filename
cat otherfile | grep 'something'
command | grep 'something'
command option1 | grep 'data'
grep --color 'data' fileName

#How do I use grep command to search a file?
Search /etc/passwd file for boo user, enter:
$grep boo /etc/passwd

#Sample outputs:
You can force grep to ignore word case i.e match boo, Boo, BOO and all other combination with the -i option:
$grep -i "boo" /etc/passwd

Use grep recursively
You can search recursively i.e. read all files under each directory for a string ""
$ grep -r "" /etc/
$grep -R "" /etc/

Sample outputs:
/etc/ppp/options:# ms-wins
/etc/ppp/options:# ms-wins
/etc/NetworkManager/system-connections/Wired connection 1:addresses1=;24;;
You will see result for on a separate line preceded by the name of the file (such as /etc/ppp/options) in which it was found. The inclusion of the file names in the output data can be suppressed by using the -h option as follows:
$ grep -h -R "" /etc/
$ grep -hR "" /etc/

Sample outputs:
# ms-wins
# ms-wins
Use grep to search words only

When you search for boo, grep will match fooboo, boo123, barfoo35 and more. You can force the grep command to select only those lines containing matches that form whole words i.e. match only boo word:
$ grep -w "boo" file

#Use grep to search 2 different words
Use the egrep command as follows:
$ egrep -w 'word1|word2' /path/to/file

#Count line when words has been matched
The grep can report the number of times that the pattern has been matched for each file using -c (count) option:
$ grep -c 'word' /path/to/file

#Pass the -n option to precede each line of output with the number of the line in the text file from which it was obtained:
$ grep -n 'root' /etc/passwd

Sample outputs:
Grep invert match

#You can use -v option to print inverts the match; that is, it matches only those lines that do not contain the given word. For example print all line that do not contain the word bar:
$ grep -v bar /path/to/file

#UNIX / Linux pipes and grep command
grep command often used with shell pipes. In this example, show the name of the hard disk devices:
# dmesg | egrep '(s|h)d[a-z]'

#Display cpu model name:
# cat /proc/cpuinfo | grep -i 'Model'

However, above command can be also used as follows without shell pipe:
# grep -i 'Model' /proc/cpuinfo

Sample outputs:
model                    : 30
model name         : Intel(R) Core(TM) i7 CPU       Q 820  @ 1.73GHz
model                    : 30
model name         : Intel(R) Core(TM) i7 CPU       Q 820  @ 1.73GHz
How do I list just the names of matching files?

#Use the -l option to list file name whose contents mention main():
$ grep -l 'main' *.c

#Finally, you can force grep to display output in colors, enter:
$ grep --color vivek /etc/passwd

#Global variable errorInfo provides stack trace:
set errorInfo
syntax error in expression "$n + i*i"
while executing
"expr {$n + i*i}"
invoked from within
"set n [expr {$n + i*i}]..."
("foreach" body line 2)
set a(0,0) 1
set a(0,1) 2
set a(1,0) 3
set a(1,1) 4
puts [array get a]

0,0 1 1,0 3 0,1 2 1,1 4

set b(0,0) 1
set b(0,1) 2
set b(1,0) 3
set b(1,1) 4

 #How collision is detected?
A jam signal indicates a collision on the wire.

#How do u know when frame ends in Ethernet.
The transmitter simply stops, at the end of the frame. The gap allows the receivers to recognize that the transmitter has stopped.

#Threads in TCL
he Tcl core is thread safe, which allows you to incorporate Tcl into multithreaded applications without customizing the Tcl core. To enable Tcl multithreading support, you must include the --enable-threads option to configure when you configure and compile your Tcl core. An important constraint of the Tcl threads implementation is that only the thread that created a Tcl interpreter can use that interpreter. In other words, multiple threads can not access the same Tcl interpreter. (However, as was the case in previous releases, a single thread can safely create and use multiple interpreters).Tcl does provide Tcl_CreateThread for creating threads. The caller can │ determine the size of the stack given to the new thread and modify the │ behaviour through the supplied flags. The value TCL_THREAD_STACK_DEFAULT for the stackSize indicates that the default │ size as specified by the operating system is to be used for the new │ thread. As for the flags, currently are only the values │ TCL_THREAD_NOFLAGS and TCL_THREAD_JOINABLE defined. The first of them │ invokes the default behaviour with no specialties. Using the second │ value marks the new thread as joinable. This means that another thread │ can wait for
the such marked thread to exit and join it. │

#Routing table resides in DRAM

#Proxy ARP must be used on the network where IP hosts are not configured with a default gateway or do not have any routing intelligence. proxy ARP is enabled by default on Cisco routers.

#Routing protocol convergence.
RIP is a routing protocol that converges so slowly that even a network of a few routers can take a couple of minutes to converge. In case of a new route being advertised, triggered updates can speed up RIP's convergence but to flush a route that previously existed takes longer due to the holddown timers in use. OSPF is an example of a fast-converging routing protocol. A network of a few routers can converge in a matter of seconds
Rip : hold downtime + 2 or 3 update intervals. (180+2*30)secs
Eigrp : approximately 2 secs
Ospf : less than 6 secs

#Write a script for ping. The test should fail if there is loss of any packets.
set out {Pinging [] with 32 bytes of data:
Reply from bytes=32 time=45ms TTL=54
Reply from bytes=32 time=63ms TTL=54
Request timed out.
Reply from bytes=32 time=105ms TTL=54

Ping statistics for
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 45ms, Maximum = 105ms, Average = 71ms}

if {[regexp {[0-9]+\%\s+[a-z]+} $out test]} {
puts " failed and value is $test"
} else {
puts pass

#use of eval
$ tclsh
% set a 10
% set b a
% eval puts $$b

#regexp to match any valid ip address in output.
set IP
if {[regexp {(^[2][5][0-5].|^[2][0-4][0-9].|^[1][0-9][0-9].|^[0-9][0-9].|^[0-9].)([2][0-5][0-5].|[2][0-4][0-9].|[1][0-9][0-9].|[0-9][0-9].|[0-9].)([2][0-5] [0-5].|[2][0-4][0-9].|[1][0-9][0-9].|[0-9][0-9].|[0-9].)([2][0-5][0-5]|[2][0-4][0-9]|[1][0-9][0-9]|[0-9][0-9]|[0-9])$} $IP match v1 v2 v3 v4]} {
puts "$v1$v2$v3$v4"
} else {
puts "none"

#to achieve load balance, make sure variance(X) value is
X*[successor FD] > [feasible successor FD]
X > [386560]/[156160]
X > 2
so we'll take value that is greater than 2 for variance, we'll use 3
R2(config)#router eigrp 1
R2(config-router)#variance 3

# Used as a one dimensional array
for { set i 0 } { $i < 8 } { incr i } {
  set base($i) $i
  puts "base($i) = $base($i)"

base(0) = 0
base(1) = 1
base(2) = 2
base(3) = 3
base(4) = 4
base(5) = 5
base(6) = 6
base(7) = 7

 # Used as a two dimensional array
# NOTE: "$i,$j" is a single string which is the index like "0,1"
for { set i 0 } { $i < 3 } { incr i } {
  for { set j 0 } { $j < 3 } { incr j } {
    set base($i,$j) $i
    puts "base($i,$j) = $base($i,$j)"

base(0,0) = 0
base(0,1) = 0
base(0,2) = 0
base(1,0) = 1
base(1,1) = 1
base(1,2) = 1
base(2,0) = 2
base(2,1) = 2
base(2,2) = 2

#Ethernet frames use an implied postamble by leaving a gap between each Ethernet frame. This gap, known as the Ethernet interframe gap, is used to space Ethernet frames. The Ethernet interframe gap is a specific measure of the time required to send 96 bits of data (9.6 μs on a 10-Mbps Ethernet network segment).

By default, 6 significant digits are used when returning a floating point value. This can be changed by setting the tcl_precision variable to the number of significant digits desired. 17 digits of precision is enough to ensure that no
information is lost when converting back and forth between a string and an IEEE double precision number.

Example 2-1 A standalone Tcl script on UNIX.
puts stdout {Hello, World!}

Using /bin/sh to run a Tcl script.
# The backslash makes the next line a comment in Tcl \
exec /some/very/long/path/to/wish "$0" ${1+"[email protected]"}
# ... Tcl script goes here ...

#Comparing strings with string compare.
if {[string compare $s1 $s2] == 0} {
# strings are equal
The string equal command added in Tcl 8.1 makes this simpler:

#Comparing strings with string equal.
if {[string equal $s1 $s2]} {
# strings are equal

 #Deleting a list element by value.
proc ldelete {list value } {
set ix [lsearch -exact $list $value]
if {$ix >= 0} {
puts [lreplace $list $ix $ix]
} else {
puts $list
ldelete "1 2 3 4 5" 3

#A read loop using read and split.
foreach line [split [read $channel] \n] {
# Process line
close $channel

Use pkg_mkIndex to maintain your index files. Decide at this time whether or not to use direct package loading.
Put the appropriate package require and package provide commands in your code.
Ensure that your library directories, or their parent directories, are listed in the auto_path variable.

tcl_platform(platform) is one of unix, macintosh, or windows.
tcl_platform(os) identifies the operating system. Examples include MacOS, Solaris, Linux,
Win32s (Windows 3.1 with the Win32 subsystem), Windows 95, Windows NT, and SunOS.
tcl_platform(osVersion) gives the version number of the operating system.
tcl_platform(machine) identifies the hardware. Examples include ppc (Power PC), 68k
(68000 family), sparc, intel, mips, and alpha.
tcl_platform(isWrapped) indicates that the application has been wrapped up into a single
executable with TclPro Wrapper. This is not defined in normal circumstances.
tcl_platform(user) gives the login name of the current user.
tcl_platform(debug) indicates that Tcl was compiled with debugging symbols.
tcl_platform(thread) indicates that Tcl was compiled with thread support enabled.

#What is Memory Allocation Failure?
Memory allocation failure means either:
The router has used all available memory (temporarily or permanently), or The memory has fragmented into such small pieces that the router cannot find a usable available block. This can happen with the processor memory (used by the Cisco Internet Operating System [IOS]) or with the packet memory (used by incoming and outgoing packets).
Symptoms of memory allocation failure include, but are not limited to:
The console or log message: "%SYS−2−MALLOCFAIL: Memory allocation of 1028 bytes failed
from 0x6015EC84, Pool Processor, alignment 0"
· Refused Telnet sessions
· The show processor memory command is displayed no matter what command you type on a console
· No output from some show commands
· "Low on memory" messages
· The console message "Unable to create EXEC − no memory or too many processes"
· Router hanging, no console response.

#Ospf convergence
Convergence = Failure_Detection_Time + Event_Propagation_Time + SPF_Run_Time + RIB_FIB_Update_Time
The formula reflects the fact that convergence time for a link-state protocol is sum of the following components:
Time to detect the network failure, e.g. interface down condition.
Time to propagate the event, i.e. flood the LSA across the topology.
Time to perform SPF calculations on all routers upon reception of the new information.
Time to update the forwarding tables for all routers in the area.
Estimated network convergence time in response to initial event: 32*2 + 10*2 + 10 + 10 = 40+64 = 100ms
worst case is 3 sec