Friday

Java Interview Questions And Answers

What is Collection API ?
The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces.
Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.
Example of interfaces: Collection, Set, List and Map.

Is Iterator a Class or Interface? What is its use?
Answer: Iterator is an interface which is used to step through the elements of a Collection.

What is similarities/difference between an Abstract class and Interface?
Differences are as follows:
Interfaces provide a form of multiple inheritance. A class can extend only one other class. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.
A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class. Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast.
Similarities:

Neither Abstract classes or Interface can be instantiated.

Java Interview Questions - How to define an Abstract class?
A class containing abstract method is called Abstract class. An Abstract class can't be instantiated.
Example of Abstract class:
abstract class testAbstractClass {
protected String myString;
public String getMyString() {
return myString;
}
public abstract string anyAbstractFunction();
}

How to define an Interface in Java ?
In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.
Emaple of Interface:

public interface sampleInterface {
public void functionOne();

public long CONSTANT_ONE = 1000;
}

If a class is located in a package, what do you need to change in the OS environment to be able to use it?
You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let's say a class Employee belongs to a package com.xyz.hr; and is located in the file c:\dev\com\xyz\hr\Employee.java. In this case, you'd need to add c:\dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
c:\>java com.xyz.hr.Employee

How many methods in the Serializable interface?
There is no method in the Serializable interface. The Serializable interface acts as a marker, telling the object serialization tools that your class is serializable.

How many methods in the Externalizable interface?
There are two methods in the Externalizable interface. You have to implement these two methods in order to make your class externalizable. These two methods are readExternal() and writeExternal().

What is the difference between Serializalble and Externalizable interface?
When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process.

What is a transient variable in Java?
A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static.

Which containers use a border layout as their default layout?
The Window, Frame and Dialog classes use a border layout as their default layout.

How are Observer and Observable used?
Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated, it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.

Wednesday

HTML Interview Questions And Answers

What is HTML?
Answer1:
HTML, or HyperText Markup Language, is a Universal language which allows an individual using special code to create web pages to be viewed on the Internet.

Answer2:
HTML ( H yper T ext M arkup L anguage) is the language used to write Web pages. You are looking at a Web page right now.
You can view HTML pages in two ways:
* One view is their appearance on a Web browser, just like this page -- colors, different text sizes, graphics.
* The other view is called "HTML Code" -- this is the code that tells the browser what to do

What is a tag?
In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for many reasons -- to change the appearance of text, to show a graphic, or to make a link to another page.

How do I create frames? What is a frameset?
Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can be displayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolled independently of each other, and links can update the document displayed in one frame without affecting the others.
You can't just "add frames" to an existing document. Rather, you must create a frameset document that defines a particular combination of frames, and then display your content documents inside those frames. The frameset document should also include alternative non-framed content in a NOFRAMES element.
The HTML 4 frames model has significant design flaws that cause usability problems for web users. Frames should be used only with great care.

How can I include comments in HTML?
Technically, since HTML is an SGML application, HTML uses SGML comment syntax. However, the full syntax is complex, and browsers don't support it in its entirety anyway. Therefore, use the following simplified rule to create HTML comments that both have valid syntax and work in browsers:

An HTML comment begins with "", and does not contain "--" or ">" anywhere in the comment.
The following are examples of HTML comments:

*
*
*

Do not put comments inside tags (i.e., between "<" and ">") in HTML markup.

What is a Hypertext link?
A hypertext link is a special tag that links one page to another page or resource. If you click the link, the browser jumps to the link's destination.

How comfortable are you with writing HTML entirely by hand?

Very. I don’t usually use WYSIWYG. The only occasions when I do use Dreamweaver are when I want to draw something to see what it looks like, and then I’ll usually either take that design and hand-modify it or build it all over again from scratch in code. I have actually written my own desktop HTML IDE for Windows (it’s called Less Than Slash) with the intention of deploying it for use in web development training. If has built-in reference features, and will autocomplete code by parsing the DTD you specify in the file. That is to say, the program doesn’t know anything about HTML until after it parses the HTML DTD you specified. This should give you some idea of my skill level with HTML.

What is everyone using to write HTML?
Everyone has a different preference for which tool works best for them. Keep in mind that typically the less HTML the tool requires you to know, the worse the output of the HTML. In other words, you can always do it better by hand if you take the time to learn a little HTML.

What is a DOCTYPE? Which one do I use?
According to HTML standards, each HTML document begins with a DOCTYPE declaration that specifies which version of HTML the document uses. Originally, the DOCTYPE declaration was used only by SGML-based tools like HTML validators, which needed to determine which version of HTML a document used (or claimed to use).
Today, many browsers use the document's DOCTYPE declaration to determine whether to use a stricter, more standards-oriented layout mode, or to use a "quirks" layout mode that attempts to emulate older, buggy browsers.

Can I nest tables within tables?
Yes, a table can be embedded inside a cell in another table. Here's a simple example:






this is the first cell of the outer tablethis is the second cell of the outer table,

with the inner table embedded in it





this is the first cell of the inner tablethis is the second cell of the inner table



The main caveat about nested tables is that older versions of Netscape Navigator have problems with them if you don't explicitly close your TR, TD, and TH elements. To avoid problems, include every , , and tag, even though the HTML specifications don't require them. Also, older versions of Netscape Navigator have problems with tables that are nested extremely deeply (e.g., tables nested ten deep). To avoid problems, avoid nesting tables more than a few deep. You may be able to use the ROWSPAN and COLSPAN attributes to minimize table nesting. Finally, be especially sure to validate your markup whenever you use nested tables.

EJB Interview Questions And Answers

What are the two important TCP Socket classes?
Socket and ServerSocket.
ServerSocket is used for normal two-way socket communication. Socket class allows us to read and write through the sockets. getInputStream() and getOutputStream() are the two methods available in Socket class.

What technologies are included in J2EE?
The main technologies in J2EE are: Enterprise JavaBeansTM (EJBsTM), JavaServer PagesTM (JSPsTM), Java Servlets, the Java Naming and Directory InterfaceTM (JNDITM), the Java Transaction API (JTA), CORBA, and the JDBCTM data access API.

What is the difference between EJB and Java beans?
EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.

What is EJB role in J2EE?
EJB technology is the core of J2EE. It enables developers to write reusable and portable server-side business logic for the J2EE platform.

Tell me something about Local Interfaces.
EJB was originally designed around remote invocation using the Java Remote Method Invocation (RMI) mechanism, and later extended to support to standard CORBA transport for these calls using RMI/IIOP. This design allowed for maximum flexibility in developing applications without consideration for the deployment scenario, and was a strong feature in support of a goal of component reuse in J2EE. Many developers are using EJBs locally, that is, some or all of their EJB calls are between beans in a single container. With this feedback in mind, the EJB 2.0 expert group has created a local interface mechanism. The local interface may be defined for a bean during development, to allow streamlined calls to the bean if a caller is in the same container. This does not involve the overhead involved with RMI like marshalling etc. This facility will thus improve the performance of applications in which co-location is planned. Local interfaces also provide the foundation for container-managed relationships among entity beans with container-managed persistence.

What is Enterprise JavaBeans (EJB) container?
It manages the execution of enterprise beans for J2EE applications.
Enterprise beans and their container run on the J2EE server.

What is in-memory replication?
The process by which the contents in the memory of one physical m/c are replicated in all the m/c in the cluster is called in-memory replication.

What is Ripple Effect?
The process of propagating the changes in the properties of a server group during runtime to all the associated clones is called Ripple Effect.

What is a Clone?
The copies of a server group are called Clones. But unlike a Server Group Clones are associated with a node and are real server process running in that node.

What are the types of Scaling
There are two types of scaling: Vertical Scaling and Horizontal Scaling.
Vertical Scaling - When multiple server clones of an application server are defined on the same physical m/c, it is called Vertical Scaling. The objective is to use the processing power of that m/c more efficiently.
Horizontal Scaling - When Clones of an application server are defined on multiple physical m/c, it is called Horizontal Scaling. The objective is to use more than one less powerful m/c more efficiently.

What is a Server Group?
A server group is a template of an Application Server(and its contents) i.e, it is a logical representation of the application server. It has the same structure and attributes as the real Application Server, but it is not associated with any node, and does not correspond to any real server process running on any node.

CSS Interview Questions And Answers

What is CSS?
1. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. Every element type as well as every occurrence of a specific element within that type can be declared an unique style, e.g. margins, positioning, color or size.

2. CSS is a web standard that describes style for XML/HTML documents.

3. CSS is a language that adds style (colors, images, borders, margins…) to your site. It’s really that simple. CSS is not used to put any content on your site, it’s just there to take the content you have and make it pretty. First thing you do is link a CSS-file to your HTML document. Do this by adding this line:


The line should be placed in between your and tags. If you have several pages you could add the exact same line to all of them and they will all use the same stylesheet, but more about that later. Let’s look inside the file “style.css” we just linked to.

h1 {
font-size: 40px;
height: 200px;
}
.warning {
color: Red;
font-weight: bold;
}
#footer {
background-color: Gray;
}

4. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents. This is also where information meets the artistic abilities of a web-designer. CSS helps you spice up your web-page and make it look neat in wide variety of aspects.

What are Cascading Style Sheets?
A Cascading Style Sheet (CSS) is a list of statements (also known as rules) that can assign various rendering properties to HTML elements. Style rules can be specified for a single element occurrence, multiple elements, an entire document, or even multiple documents at once. It is possible to specify many different rules for an element in different locations using different methods. All these rules are collected and merged (known as a "cascading" of styles) when the document is rendered to form a single style rule for each element.

How do I center block-elements with CSS1?
There are two ways of centering block level elements:

1. By setting the properties margin-left and margin-right to auto and width to some explicit value:

BODY {width: 30em; background: cyan;}
P {width: 22em; margin-left: auto; margin-right: auto}

In this case, the left and right margins will each be four ems wide, since they equally split up the eight ems left over from (30em - 22em). Note that it was not necessary to set an explicit width for the BODY element; it was done here to keep the math clean.

Another example:

TABLE {margin-left: auto; margin-right: auto; width: 400px;}
In most legacy browsers, a table's width is by default determined by its content. In CSS-conformant browsers, the complete width of any element (including tables) defaults to the full width of its parent element's content area. As browser become more conformant, authors will need to be aware of the potential impact on their designs.

If background and color should always be set together, why do they exist as separate properties?
There are several reasons for this. First, style sheets become more legible -- both for humans and machines. The background property is already the most complex property in CSS1 and combining it with color would make it even more complex. Second, color inherits, but background doesn't and this would be a source of confusion.

What is class?
Class is a group of 1) instances of the same element to which an unique style can be attached or 2) instances of different elements to which the same style can be attached.

1) The rule P {color: red} will display red text in all paragraphs. By classifying the selector P different style can be attached to each class allowing the display of some paragraphs in one style and some other paragraphs in another style.
2) A class can also be specified without associating a specific element to it and then attached to any element which is to be styled in accordance with it's declaration. All elements to which a specific class is attached will have the same style.

To classify an element add a period to the selector followed by an unique name. The name can contain characters a-z, A-Z, digits 0-9, period, hyphen, escaped characters, Unicode characters 161-255, as well as any Unicode character as a numeric code, however, they cannot start with a dash or a digit. (Note: in HTML the value of the CLASS attribute can contain more characters). (Note: text between /* and */ are my comments).
CSS
P.name1 {color: red} /* one class of P selector */
P.name2 {color: blue} /* another class of P selector */
.name3 {color: green} /* can be attached to any element */

HTML

This paragraph will be red


This paragraph will be blue


This paragraph will be green


  • This list item will be green


  • It is a good practice to name classes according to their function than their appearance; e.g. P.fotnote and not P.green. In CSS1 only one class can be attached to a selector. CSS2 allows attaching more classes, e.g.:
    P.name1.name2.name3 {declaration}

    This paragraph has three classes attached



    What is grouping ?
    Grouping is gathering (1) into a comma separated list two or more selectors that share the same style or (2) into a semicolon separated list two or more declarations that are attached to the same selector (2).

    1. The selectors LI, P with class name .first and class .footnote share the same style, e.g.:
    LI {font-style: italic}
    P.first {font-style: italic}
    .footnote {font-style: italic}

    To reduce the size of style sheets and also save some typing time they can all be grouped in one list.
    LI, P.first, .footnote {font-style: italic}

    2. The declarations {font-style: italic} and {color: red} can be attached to one selector, e.g.:
    H2 {font-style: italic}
    H2 {color: red}
    and can also be grouped into one list:
    H2 {font-style: italic; color: red}

    What is external Style Sheet? How to link?
    External Style Sheet is a template/document/file containing style information which can be linked with any number of HTML documents. This is a very convenient way of formatting the entire site as well as restyling it by editing just one file. The file is linked with HTML documents via the LINK element inside the HEAD element. Files containing style information must have extension .css, e.g. style.css.

    Is CSS case sensitive?
    Cascading Style Sheets (CSS) is not case sensitive. However, font families, URLs to images, and other direct references with the style sheet may be.
    The trick is that if you write a document using an XML declaration and an XHTML doctype, then the CSS class names will be case sensitive for some browsers.

    It is a good idea to avoid naming classes where the only difference is the case, for example:

    div.myclass { ...}
    div.myClass { ... }

    If the DOCTYPE or XML declaration is ever removed from your pages, even by mistake, the last instance of the style will be used, regardless of case.
    Page Numbers : 1

    Friday

    C++ Interview Questions And Answers

    What is C++?

    Released in 1985, C++ is an object-oriented programming language created by Bjarne Stroustrup. C++ maintains almost all aspects of the C language, while simplifying memory management and adding several features - including a new datatype known as a class (you will learn more about these later) - to allow object-oriented programming. C++ maintains the features of C which allowed for low-level memory access but also gives the programmer new tools to simplify memory management.

    C++ used for:

    C++ is a powerful general-purpose programming language. It can be used to create small programs or large applications. It can be used to make CGI scripts or console-only DOS programs. C++ allows you to create programs to do almost anything you need to do. The creator of C++, Bjarne Stroustrup, has put together a partial list of applications written in C++.
    How do you find out if a linked-list has an end? (i.e. the list is not a cycle)

    You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.

    What is the difference between realloc() and free()?

    The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines. Undefined results occur if the Pointer parameter is not a valid pointer.

    What is function overloading and operator overloading?
    Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When an overloaded function is called, the C++ compiler selects the proper function by examining the number, types and order of the arguments in the call. Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types.
    Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).
    What is the difference between declaration and definition?

    The declaration tells the compiler that at some later point we plan to present the definition of this declaration.
    E.g.: void stars () //function declaration
    The definition contains the actual implementation.
    E.g.: void stars () // declarator
    {
    for(int j=10; j > =0; j--) //function body
    cout << *;
    cout << endl; }
    What are the advantages of inheritance?

    It permits code reusability. Reusability saves time in program development. It encourages the reuse of proven and debugged high-quality software, thus reducing problem after a system becomes functional.

    How do you write a function that can reverse a linked-list?

    void reverselist(void)
    {
    if(head==0)
    return;
    if(head->next==0)
    return;
    if(head->next==tail)
    {
    head->next = 0;
    tail->next = head;
    }
    else
    {
    node* pre = head;
    node* cur = head->next;
    node* curnext = cur->next;
    head->next = 0;
    cur-> next = head;

    for(; curnext!=0; )
    {
    cur->next = pre;
    pre = cur;
    cur = curnext;
    curnext = curnext->next;
    }

    curnext->next = cur;
    }
    }

    Thursday

    C# Interview Questions And Answers

    What's C# ?
    C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

    Is it possible to inline assembly or IL in C# code?
    - No.

    Is it possible to have different access modifiers on the get/set methods of a property?
    - No. The access modifier on a property applies to both its get and set accessors. What you need to do if you want them to be different is make the property read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.

    Is it possible to have a static indexer in C#? allowed in C#.
    - No. Static indexers are not

    If I return out of a try/finally in C#, does the code in the finally-clause run?
    -Yes. The code in the finally always runs. If you return out of the try block, or even if you do a goto out of the try, the finally block always runs:
    using System;
    class main
    {
    public static void Main()
    {
    try
    {
    Console.WriteLine(\"In Try block\");
    return;
    }
    finally
    {
    Console.WriteLine(\"In Finally block\");
    }
    }
    }

    Both In Try block and In Finally block will be displayed. Whether the return is in the try block or after the try-finally block, performance is not affected either way. The compiler treats it as if the return were outside the try block anyway. If it’s a return without an expression (as it is above), the IL emitted is identical whether the return is inside or outside of the try. If the return has an expression, there’s an extra store/load of the value of the expression (since it has to be computed within the try block).

    I was trying to use an out int parameter in one of my functions. How should I declare the variable that I am passing to it?

    You should declare the variable as an int, but when you pass it in you must specify it as ‘out’, like the following: int i; foo(out i); where foo is declared as follows:
    [return-type] foo(out int o) { }

    How does one compare strings in C#?
    In the past, you had to call .ToString() on the strings when using the == or != operators to compare the strings’ values. That will still work, but the C# compiler now automatically compares the values instead of the references when the == or != operators are used on string types. If you actually do want to compare references, it can be done as follows: if ((object) str1 == (object) str2) { } Here’s an example showing how string compares work:
    using System;
    public class StringTest
    {
    public static void Main(string[] args)
    {
    Object nullObj = null; Object realObj = new StringTest();
    int i = 10;
    Console.WriteLine(\"Null Object is [\" + nullObj + \"]\n\"
    + \"Real Object is [\" + realObj + \"]\n\"
    + \"i is [\" + i + \"]\n\");
    // Show string equality operators
    string str1 = \"foo\";
    string str2 = \"bar\";
    string str3 = \"bar\";
    Console.WriteLine(\"{0} == {1} ? {2}\", str1, str2, str1 == str2 );
    Console.WriteLine(\"{0} == {1} ? {2}\", str2, str3, str2 == str3 );
    }
    }

    Output:

    Null Object is []
    Real Object is [StringTest]
    i is [10]
    foo == bar ? False
    bar == bar ? True

    How do you specify a custom attribute for the entire assembly (rather than for a class)?
    Global attributes must appear after any top-level using clauses and before the first type or namespace declarations. An example of this is as follows:
    using System;
    [assembly : MyAttributeClass] class X {}
    Note that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs.

    C Interview Questions And Answers

    What will print out?
    main()
    {
    char *p1=“name”;
    char *p2;
    p2=(char*)malloc(20);
    memset (p2, 0, 20);
    while(*p2++ = *p1++);
    printf(“%s\n”,p2);
    }
    The pointer p2 value is also increasing with p1 .
    *p2++ = *p1++ means copy value of *p1 to *p2 , then increment both addresses (p1,p2) by one , so that they can point to next address . So when the loop exits (ie when address p1 reaches next character to “name” ie null) p2 address also points to next location to “name” . When we try to print string with p2 as starting address , it will try to print string from location after “name” … hence it is null string ….

    e.g. :
    initially p1 = 2000 (address) , p2 = 3000
    *p1 has value “n” ..after 4 increments , loop exits … at that time p1 value will be 2004 , p2 =3004 … the actual result is stored in 3000 - n , 3001 - a , 3002 - m , 3003 -e … we r trying to print from 3004 …. where no data is present … that's why its printing null .

    Answer: empty string.

    What will be printed as the result of the operation below:
    main()
    {
    int x=20,y=35;
    x=y++ + x++;
    y= ++y + ++x;
    printf(“%d%d\n”,x,y)
    ;
    }
    Answer : 5794

    What will be printed as the result of the operation below:
    main()
    {
    int x=5;
    printf(“%d,%d,%d\n”,x,x<<2,>>2)
    ;
    }
    Answer: 5,20,1

    What will be printed as the result of the operation below:
    #define swap(a,b) a=a+b;b=a-b;a=a-b;
    void main()
    {
    int x=5, y=10;
    swap (x,y);
    printf(“%d %d\n”,x,y)
    ; swap2(x,y);
    printf(“%d %d\n”,x,y)
    ; }

    int swap2(int a, int b)
    {
    int temp;
    temp=a;
    b=a;
    a=temp;
    return 0;
    }
    as x = 5 = 0×0000,0101; so x << 2 -< 0×0001,0100 = 20; x >7gt; 2 -> 0×0000,0001 = 1. Therefore, the answer is 5, 20 , 1

    the correct answer is
    10, 5
    5, 10

    Answer: 10, 5

    What will be printed as the result of the operation below:

    main()
    {
    char *ptr = ” Tech Preparation”;
    *ptr++; printf(“%s\n”,ptr)
    ; ptr++;
    printf(“%s\n”,ptr);

    }
    1) ptr++ increments the ptr address to point to the next address. In the previous example, ptr was pointing to the space in the string before C, now it will point to C.

    2)*ptr++ gets the value at ptr++, the ptr is indirectly forwarded by one in this case.

    3)(*ptr)++ actually increments the value in the ptr location. If *ptr contains a space, then (*ptr)++ will now contain an exclamation mark.

    Answer: Tech Preparation

    What will be printed as the result of the operation below:
    main()
    {
    char s1[]=“Tech”;
    char s2[]= “preparation”;
    printf(“%s”,s1)
    ; }
    Answer: Tech

    What will be printed as the result of the operation below:
    main()
    {
    char *p1;
    char *p2;

    p1=(char *)malloc(25);
    p2=(char *)malloc(25);

    strcpy(p1,”Tech”);
    strcpy(p2,“preparation”);
    strcat(p1,p2);

    printf(“%s”,p1)
    ;
    }
    Answer: Techpreparation

    Wednesday

    Bluetooth Interview Questions Answers

    Why is Bluetooth 2.0 better?
    The main features of Bluetooth Core Specification Version 2.0 + EDR are:
    • 3 times faster transmission speed (up to 10 times in certain cases)
    • Lower power consumption through reduced duty cycle
    • Simplification of multi-link scenarios due to more available bandwidth
    • Backwards compatible to earlier versions
    • Further improved BER (Bit Error Rate) performance

    Name few applications of Bluetooth?
    * Wireless control of and communication between a cell phone and a hands free headset or car kit. This is the most popular use.
    * Wireless networking between PCs in a confined space and where little bandwidth is required.
    * Wireless communications with PC input devices such as mouses and keyboards and output devices such as printers.
    * Transfer of files between devices via OBEX.
    * Transfer of contact details, calendar appointments, and reminders between devices via OBEX.
    * Replacement of traditional wired serial communications in test equipment, GPS receivers and medical equipment.
    * For remote controls where infrared was traditionally used.
    * Sending small advertisements from Bluetooth enabled advertising hoardings to other, discoverable, Bluetooth devices.
    * Wireless control of a games console, Nintendo’s Wii and Sony’s PlayStation 3 will both use Bluetooth technology for their wireless controllers.
    * Sending commands and software to the upcoming LEGO Mindstorms NXT instead of infra red.

    How many devices can communicate concurrently?
    A Bluetooth device playing the role of the “master” can communicate with up to 7 devices playing the role of the “slave”. This network of “group of up to 8 devices” (1 master + 7 slaves) is called a piconet. A piconet is an ad-hoc computer network of devices using Bluetooth technology protocols to allow one master device to interconnect with up to seven active slave devices (because a three-bit MAC address is used). Up to 255 further slave devices can be inactive, or parked, which the master device can bring into active status at any time.

    What is Pairing?
    Pairs of devices may establish a trusted relationship by learning (by user input) a shared secret known as a “passkey”. A device that wants to communicate only with a trusted device can cryptographically authenticate the identity of the other device. Trusted devices may also encrypt the data that they exchange over the air so that no one can listen in. The encryption can however be turned off and passkeys are stored on the device’s file system and not the Bluetooth chip itself. Since the Bluetooth address is permanent a pairing will be preserved even if the Bluetooth name is changed. Pairs can be deleted at any time by either device. Devices will generally require pairing or will prompt the owner before it allows a remote device to use any or most of its services. Some devices such as Sony Ericsson phones will usually accept OBEX business cards and notes without any pairing or prompts. Certain printers and access points will allow any device to use its services by default much like unsecured Wi-Fi networks.

    How secure a Bluetooth device is?
    Bluetooth uses the SAFER+ algorithm for authentication and key generation. The E0 stream cipher is used for encrypting packets. This makes eavesdropping on Bluetooth-enabled devices more difficult.

    What is Bluetooth SIG?
    Bluetooth Special Interest Group (SIG)

    Bluetooth wireless technology is revolutionizing personal connectivity by providing freedom from wired connections. It is a specification for a small-form factor, low-cost radio solution providing links between mobile computers, mobile phones, other portable handheld devices and automobiles, as well as connectivity to the Internet. The Bluetooth SIG, comprised of leaders in the telecommunications, computing, automotive and consumer electronics industries, is driving development of the technology and bringing it to market. The Bluetooth SIG includes Promoter member companies Agere, Ericsson, IBM, Intel, Microsoft, Motorola, Nokia and Toshiba, and thousands of Associate and Adopter member companies. The Bluetooth SIG, Inc. headquarters are located in Overland Park, Kansas, U.S.A.

    BEA WebLogic Interview Questions And Answers

    What is BEA Weblogic?
    BEA WebLogic is a J2EE application server and also an HTTP web server by BEA Systems of San Jose, California, for Unix, Linux, Microsoft Windows, and other platforms. WebLogic supports Oracle, DB2, Microsoft SQL Server, and other JDBC-compliant databases. WebLogic Server supports WS-Security and is compliant with J2EE 1.3.
    BEA WebLogic Server is part of the BEA WebLogic Platform™. The other parts of WebLogic Platform are:
    * Portal, which includes Commerce Server and Personalization Server (which is built on a BEA-produced Rete rules engine),
    * WebLogic Integration,
    * WebLogic Workshop, an IDE for Java, and
    * JRockit, a JVM for Intel CPUs.

    WebLogic Server includes .NET interoperability and supports the following native integration capabilities:
    * Native enterprise-grade JMS messaging
    * J2EE Connector Architecture
    * WebLogic/Tuxedo Connector
    * COM+ Connectivity
    * CORBA connectivity
    * IBM WebSphere MQ connectivity

    BEA WebLogic Server Process Edition also includes Business Process Management and Data Mapping functionality.
    WebLogic supports security policies managed by Security Administrators. The BEA WebLogic Server Security Model includes:
    * Separate application business logic from security code
    * Complete scope of security coverage for all J2EE and non-J2EE components

    Which of the following statements are true regarding MDBs (Message Driven Beans) on version 6.0 of WebLogic App Server?
    a. MDBs support concurrent processing for both Topics and Queues.
    b. MDBs support concurrent processing for only Topics.
    c. MDBs support concurrent processing for only Queues.
    d. MDBs support concurrent processing neither Topics nor Queues.
    Choice A is correct. MDBs support concurrent processing for both Topics and Queues. Previously, only concurrent processing for Queues was supported. To ensure concurrency, change the weblogic-ejb-jar.xml deployment descriptor max-beans-in-free-pool setting to >1. If this element is set to more than one, the container will spawn as many threads as specified. WebLogic Server maintains a free pool of EJBs for every stateless session bean and message driven bean class.
    The max-beans-in-free-pool element defines the size of this pool. By default, max-beans-in-free-pool has no limit; the maximum number of beans in the free pool is limited only by the available memory.

    Can I use a "native" two-tier driver for a browser applet?
    No. Within an unsigned applet, you cannot load native libraries over the wire, access the local file system, or connect to any host except the host from which you loaded the applet. The applet security manager enforces these restrictions on applets as protection against applets being able to do unsavory things to unsuspecting users.
    If you are trying to use jDriver for Oracle from an applet, then you are violating the first restriction. Your applet will fail when it attempts to load the native (non-Java layer) library that allows jDriver for Oracle to make calls into the non-Java Oracle client libraries. If you look at the exception that is generated, you will see that your applet fails in java.lang.System.loadLibrary, because the security manager determined that you were attempting to load a local library and halted the applet.
    You can, however, use the WebLogic JTS or Pool driver for JDBC connectivity in applets. When you use one of these WebLogic multitier JDBC drivers, you need one copy of WebLogic jDriver for Oracle (or any other two-tier JDBC driver) for the connection between the WebLogic Server and the DBMS.

    I'm using a WebLogic multitier driver in an applet as an interface to a DBMS. If I run the class using the Sun Appletviewer on my local machine, I have no problems. But when I try to run the applet in a Netscape browser, it will not connect.
    If Appletviewer works and Netscape does not, it is an indication that you are violating a Netscape security restriction. In this case, the violation is that an applet cannot open a socket to a machine other than the one from which it loaded the applet. To solve this problem, you will have to serve your applet code from the same machine that hosts the DBMS.
    In addition, the IP naming format you use in the applet CODEBASE and the constructor for the T3Client must match. That is, you can't use dot-notation in one place and a domain name in the other.

    I tried to run two of the applets in the examples directory of the distribution. I installed the WebLogic classes on my local machine (NT server) and on another machine (a Windows 95 client). I am not using any browsers, just trying to run the applets with Appletviewer. The applets work fine when I run Appletviewer from the NT server, but do not work at all from the Windows 95 client.
    There are two possible problems: Either the CODEBASE tag is not properly set in the applet HTML file, or the class files are not properly loaded on the HTTP server.
    The applet works on the NT server because you installed the WebLogic distribution on your NT server. Even if the applet cannot successfully load the necessary classes from the HTTP server, it does find them in your local CLASSPATH. But when you try to run it from the Windows 95 client, the applet must load the classes over the wire from the HTTP server, and if you haven't installed them correctly, it will fail.

    The two primary cluster services provided by WebLogic Server are?
    a. Http Session State Clustering
    b. File Service Clustering
    c. Time Service Clustering
    d. Object Clustering
    e. Event Clustering
    Choices A and D are correct. A WebLogic Server cluster is a group of servers that work together to provide a more scalable and reliable application platform than a single server. A clustered service is an API or interface that is available on multiple servers in the cluster. HTTP session state clustering and object clustering are the two primary cluster services that WebLogic Server provides. WebLogic Server also provides cluster support for JMS destinations and JDBC connections. WebLogic Server provides clustering support for servlets and JSPs by replicating the HTTP session state of clients that access clustered servlets and JSPs. To benefit from HTTP session state clustering, you must ensure that the session state is persistent, either by configure in-memory replication, file system persistence, or JDBC persistence. If an object is clustered, instances of the object are deployed on all WebLogic Servers in the cluster. The client has a choice about which instance of the object to call. This is Object Clustering. The APIs and internal services that cannot be clustered in WebLogic Server version6.0 are File services, Time services, WebLogic Events, Workspaces and ZAC.

    How do stubs work in a WebLogic Server cluster?
    Clients that connect to a WebLogic Server cluster and look up a clustered object obtain a replica-aware stub for the object. This stub contains the list of available server instances that host implementations of the object. The stub also contains the load balancing logic for distributing the load among its host servers.

    What happens when a failure occurs and the stub cannot connect to a WebLogic Server instance?
    When the failure occurs, the stub removes the failed server instance from its list. If there are no servers left in its list, the stub uses DNS again to find a running server and obtain a current list of running instances. Also, the stub periodically refreshes its list of available server instances in the cluster; this allows the stub to take advantage of new servers as they are added to the cluster.

    Why did my JDBC code throw a rollback SQLException?
    Your JDBC code may throw the following exception:
    "The coordinator has rolled back the transaction.
    No further JDBC access is allowed within this transaction."
    The WebLogic JTS JDBC driver throws this exception when the current JDBC connection transaction rolls back prior to or during the JDBC call. This exception indicates that the transaction in which the JDBC connection was participating was rolled back at some point prior to or during the JDBC call.
    The rollback may have happened in an earlier EJB invoke that was part of the transaction, or the rollback may have occurred because the transaction timed out. In either case, the transaction will be rolled back, the connection returned to the pool and the database resources released. In order to proceed, the JTS JDBC connection must be closed and reopened in a new transaction.

    Must my bean-managed persistence mechanism use the WebLogic JTS driver?
    Use the TxDataSource for bean-managed persistence.

    Tuesday

    Ajax Interview Questions And Answers

    What's AJAX?
    AJAX (Asynchronous JavaScript and XML) is a newly coined term for two powerful browser features that have been around for years, but were overlooked by many web developers until recently when applications such as Gmail, Google Suggest, and Google Maps hit the streets.

    Asynchronous JavaScript and XML, or Ajax (pronounced "Aye-Jacks"), is a web development technique for creating interactive web applications using a combination of XHTML (or HTML) and CSS for marking up and styling information. (XML is commonly used, although any format will work, including preformatted HTML, plain text, JSON and even EBML).
    The Document Object Model manipulated through JavaScript to dynamically display and interact with the information presented
    The XMLHttpRequest object to exchange data asynchronously with the web server. In some Ajax frameworks and in some situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server.
    Like DHTML, LAMP, or SPA, Ajax is not a technology in itself, but a term that refers to the use of a group of technologies together. In fact, derivative/composite technologies based substantially upon Ajax, such as AFLAX, are already appearing.
    Ajax applications are mostly executed on the user's computer; they can perform a number of tasks without their performance being limited by the network. This permits the development of interactive applications, in particular reactive and rich graphic user interfaces.
    Ajax applications target a well-documented platform, implemented by all major browsers on most existing platforms. While it is uncertain that this compatibility will resist the advent of the next generations of browsers (in particular, Firefox), at the moment, Ajax applications are effectively cross-platform.
    While the Ajax platform is more restricted than the Java platform, current Ajax applications effectively fill part of the one-time niche of Java applets: extending the browser with portable, lightweight mini-applications.

    Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together in powerful new ways. Ajax incorporates:
    * standards-based presentation using XHTML and CSS;
    * dynamic display and interaction using the Document Object Model;
    * data interchange and manipulation using XML and XSLT; * asynchronous data retrieval using XMLHttpRequest;
    * and JavaScript binding everything together.

    Who’s Using Ajax ?
    Google is making a huge investment in developing the Ajax approach. All of the major products Google has introduced over the last year — Orkut, Gmail, the latest beta version of Google Groups, Google Suggest, and Google Maps — are Ajax applications. (For more on the technical nuts and bolts of these Ajax implementations, check out these excellent analyses of Gmail, Google Suggest, and Google Maps.) Others are following suit: many of the features that people love in Flickr depend on Ajax, and Amazon’s A9.com search engine applies similar techniques.
    These projects demonstrate that Ajax is not only technically sound, but also practical for real-world applications. This isn’t another technology that only works in a laboratory. And Ajax applications can be any size, from the very simple, single-function Google Suggest to the very complex and sophisticated Google Maps.
    t Adaptive Path, we’ve been doing our own work with Ajax over the last several months, and we’re realizing we’ve only scratched the surface of the rich interaction and responsiveness that Ajax applications can provide. Ajax is an important development for Web applications, and its importance is only going to grow. And because there are so many developers out there who already know how to use these technologies, we expect to see many more organizations following Google’s lead in reaping the competitive advantage Ajax provides.
    Moving Forward

    The biggest challenges in creating Ajax applications are not technical. The core Ajax technologies are mature, stable, and well understood. Instead, the challenges are for the designers of these applications: to forget what we think we know about the limitations of the Web, and begin to imagine a wider, richer range of possibilities

    Should I consider AJAX?
    AJAX definitely has the buzz right now, but it might not be the right thing for you. AJAX is limited to the latest browsers, exposes browser compatibility issues, and requires new skill-sets for many. There is a good blog entry by Alex Bosworth on AJAX Mistakes which is a good read before you jump full force into AJAX.
    On the other hand you can achieve highly interactive rich web applications that are responsive and appear really fast. While it is debatable as to whether an AJAX based application is really faster, the user feels a sense of immediacy because they are given active feedback while data is exchanged in the background. If you are an early adopter and can handle the browser compatibility issues, and are willing to learn some more skills, then AJAX is for you. It may be prudent to start off AJAX-ifying a small portion or component of your application first. We all love technology, but just remember the purpose of AJAX is to enhance your user's experience and not hinder it.

    Does AJAX work with Java?
    Absolutely. Java is a great fit for AJAX! You can use Java Enterprise Edition servers to generate AJAX client pages and to serve incoming AJAX requests, manage server side state for AJAX clients, and connect AJAX clients to your enterprise resources. The JavaServer Faces component model is a great fit for defining and using AJAX components.

    Won't my server-side framework provide me with AJAX?
    You may be benefiting from AJAX already. Many existing Java based frameworks already have some level of AJAX interactions and new frameworks and component libraries are being developed to provide better AJAX support. I won't list all the Java frameworks that use AJAX here, out of fear of missing someone, but you can find a good list at www.ajaxpatterns.org/Java_Ajax_Frameworks.
    If you have not chosen a framework yet it is recommended you consider using JavaServer Faces or a JavaServer Faces based framework. JavaServer Faces components can be created and used to abstract many of the details of generating JavaScript, AJAX interactions, and DHTML processing and thus enable simple AJAX used by JSF application developer and as plug-ins in JSF compatible IDE's, such as Sun Java Studio Creator.

    Where should I start?
    Assuming the framework you are using does not suffice your use cases and you would like to develop your own AJAX components or functionality I suggest you start with the article Asynchronous JavaScript Technology and XML (AJAX) With Java 2 Platform, Enterprise Edition.
    If you would like to see a very basic example that includes source code you can check out the tech tip Using AJAX with Java Technology. For a more complete list of AJAX resources the Blueprints AJAX home page.
    Next, I would recommend spending some time investigating AJAX libraries and frameworks. If you choose to write your own AJAX clients-side script you are much better off not re-inventing the wheel.
    AJAX in Action by Dave Crane and Eric Pascarello with Darren James is good resource. This book is helpful for the Java developer in that in contains an appendix for learning JavaScript for the Java developer.

    ASP Interview Questions And Answers

    What is ASP?
    ASP stands for Active Server Pages. It is a server side technology which is used to display dynamic content on web pages. For example you could write code that would give your visitors different information, different images or even a totally different page depending on what browser version they are using.

    How can you disable the browser to view the code?
    Writing codes within the Tag

    What is a "Virtual Directory"?
    Virtual directories are aliases for directory paths on the server. It allows moving files on the disk between different folders, drives or even servers without changing the structure of web pages. It avoids typing an extremely long URL each time to access an ASP page.

    Give the comment Tags for the following?
    VBScript : REM & ‘(apostrophe)
    JavaScript : // (single line comment)
    /* */ (Multi-line comments)

    Which is the default Scripting Language of ASP (server-side)?
    VBScript

    Which is the default Data types in VBScript?
    Variant is the default data type in VBScript, which can store a value of any type.

    What is a variable?
    Variable is a memory location through which the actual values are stored/retrieved. Its value can be changed.

    What is the maximum size of an array?
    Up to 60 dimensions.

    What is Query string collection?
    This collection stores any values that are provided in the URL. This can be generated by three methods:
    By clicking on an anchor tag
    By sending a form to the server by the GET method
    Through user-typed HTTP address

    It allows you to extract data sent to the server using a GET request.

    What are the attributes of the tags? What are their functions?
    The two attributes are ACTION and METHOD
    The ACTION gives the name of the ASP file that should be opened next by which this file can access the information given in the form The METHOD determines which of the two ways (POST or GET) the browser can send the information to the server

    What are the methods in Session Object?
    The Session Object has only one method, which is Abandon. It destroys all the objects stored in a Session Object and releases the server resources they occupied.

    What is ServerVariables collection?
    The ServerVariables collection holds the entire HTTP headers and also additional items of information about the server.

    What is the difference between Querystring collection and Form collection?
    The main difference is that the Querystring collection gets appended to a URL.

    What is a Form collection?
    The Form collection holds the values of the form elements submitted with the POST method. This is the only way to generate a Form collection.

    What are the ASP Scripting Objects?
    The Dictionary object, the FileSystemObject object, TextStream object.

    What happens to a HTML page?
    The browser makes a HTTP request; the server gives a HTTP response to the browser and the browser converts into a HTML page.

    C Interview Questions And Answers

    Question : What is C language?

    Answers : The C programming language is a standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications. ...

    printf() Function
    What is the output of printf("%d")?

    1. When we write printf("%d",x); this means compiler will print the value of x. But as here, there is nothing after �%d� so compiler will show in output window garbage value.

    2. When we use %d the compiler internally uses it to access the argument in the stack (argument stack). Ideally compiler determines the offset of the data variable depending on the format specification string. Now when we write printf("%d",a) then compiler first accesses the top most element in the argument stack of the printf which is %d and depending on the format string it calculated to offset to the actual data variable in the memory which is to be printed. Now when only %d will be present in the printf then compiler will calculate the correct offset (which will be the offset to access the integer variable) but as the actual data object is to be printed is not present at that memory location so it will print what ever will be the contents of that memory location.

    3. Some compilers check the format string and will generate an error without the proper number and type of arguments for things like printf(...) and scanf(...).

    malloc() Function- What is the difference between "calloc(...)" and "malloc(...)"?

    1. calloc(...) allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size).

    malloc(...) takes in only a single argument which is the memory required in bytes. malloc(...) allocated bytes of memory and not blocks of memory like calloc(...).

    2. malloc(...) allocates memory blocks and returns a void pointer to the allocated space, or NULL if there is insufficient memory available.

    calloc(...) allocates an array in memory with elements initialized to 0 and returns a pointer to the allocated space. calloc(...) calls malloc(...) in order to use the C++ _set_new_mode function to set the new handler mode.

    printf() Function- What is the difference between "printf(...)" and "sprintf(...)"?
    sprintf(...) writes data to the character array whereas printf(...) writes data to the standard output device.

    Compilation How to reduce a final size of executable?

    Size of the final executable can be reduced using dynamic linking for libraries.

    Linked Lists -- Can you tell me how to check whether a linked list is circular?

    Create two pointers, and set both to the start of the list. Update each as follows:
    while (pointer1) {
    pointer1 =
    pointer1->next;
    pointer2 = pointer2->next;
    if (pointer2) pointer2=pointer2->next;
    if (pointer1 == pointer2) {
    print ("circular");
    }
    }

    If a list is circular, at some point pointer2 will wrap around and be either at the item just before pointer1, or the item before that. Either way, its either 1 or 2 jumps until they meet.

    "union" Data Type What is the output of the following program? Why?

    #include
    main() {
    typedef union {
    int a;
    char b[10];
    float c;
    }
    Union;

    Union x,y = {100};
    x.a = 50;
    strcpy(x.b,"hello");
    x.c = 21.50;
    printf("Union x : %d %s %f n",x.a,x.b,x.c);
    printf("Union y : %d %s %f n",y.a,y.b,y.c);
    }

    String Processing --- Write out a function that prints out all the permutations of a string. For example, abc would give you abc, acb, bac, bca, cab, cba.
    void PrintPermu (char *sBegin, char* sRest) {
    int iLoop;
    char cTmp;
    char cFLetter[1];
    char *sNewBegin;
    char *sCur;
    int iLen;
    static int iCount;

    iLen = strlen(sRest);
    if (iLen == 2) {
    iCount++;
    printf("%d: %s%s\n",iCount,sBegin,sRest);
    iCount++;
    printf("%d: %s%c%c\n",iCount,sBegin,sRest[1],sRest[0]);
    return;
    } else if (iLen == 1) {
    iCount++;
    printf("%d: %s%s\n", iCount, sBegin, sRest);
    return;
    } else {
    // swap the first character of sRest with each of
    // the remaining chars recursively call debug print
    sCur = (char*)malloc(iLen);
    sNewBegin = (char*)malloc(iLen);
    for (iLoop = 0; iLoop < iLen; iLoop ++) {
    strcpy(sCur, sRest);
    strcpy(sNewBegin, sBegin);
    cTmp = sCur[iLoop];
    sCur[iLoop] = sCur[0];
    sCur[0] = cTmp;
    sprintf(cFLetter, "%c", sCur[0]);
    strcat(sNewBegin, cFLetter);
    debugprint(sNewBegin, sCur+1);
    }
    }
    }

    void main() {
    char s[255];
    char sIn[255];
    printf("\nEnter a string:");
    scanf("%s%*c",sIn);
    memset(s,0,255);
    PrintPermu(s, sIn);
    }

    some technical question related with c and data structure

    1.------- is associated with webservices.

    a) WSDL b) WML c) web sphere d) web logic



    2.any large single block of data stored in a database, such as a picture or sound file, which does not include record fields, and cannot be directly searched by the database’s search engine.

    a) TABLE b) BLOB c) VIEW d) SCHEME



    3.Areserved area of the immediate access memeory used to increase the running speed of the computer program.

    a) session memory b) bubble memory c) cache memory d) shared memory



    4.a small subnet that sit between atrusted internal network and an untruster external network, such as the public internet.

    a) LAN b) MAN c) WAN d) DMZ



    5.technologies that use radio waves to automatically identify people or objects,which is very similar to the barcode identification systems,seen in retail stores everyday.

    a)BLUETOOTH b) RADAR c)RSA SECURE ID d)RFID



    6.main(){

    float fl = 10.5;

    double dbl = 10.5

    if(fl ==dbl)

    printf(“UNITED WE STAND”);

    else

    printf(“DIVIDE AND RULE”)

    }

    what is the output?

    a)compilation error b)UNITED WE STAND c)DIVIDE AND RULE d)linkage error.



    7.main(){

    static int ivar = 5;

    printf(“%d”,ivar--);

    if(ivar)

    main();

    }



    what is the output?

    a)1 2 3 4 5 b) 5 4 3 2 1 c)5 d)compiler error:main cannot be recursive function.



    8.main()

    {

    extern int iExtern;

    iExtern = 20;

    printf(“%d”,iExtern);

    }

    what is the output?

    a)2 b) 20 c)compile error d)linker error



    9..#define clrscr() 100

    main(){

    clrscr();

    printf(“%d\n\t”, clrscr());

    }

    what is the output?

    a)100 b)10 c)compiler errord)linkage error



    10.main()

    {

    void vpointer;

    char cHar = ‘g’, *cHarpointer = “GOOGLE”;

    int j = 40;

    vpointer = &cHar;

    printf(“%c”,*(char*)vpointer);

    vpointer = &j;

    printf(“%d”,*(int *)vpointer);

    vpointer = cHarpointer;

    printf(“%s”,(char*)vpointer +3);

    }

    what is the output?

    a)g40GLE b)g40GOOGLE c)g0GLE d)g4GOO



    11.#define FALSE -1

    #define TRUE 1

    #define NULL 0

    main() {

    if(NULL)

    puts(“NULL”);

    else if(FALSE)

    puts(“TRUE”);

    else

    puts(“FALSE”);

    }

    what is the output?

    a)NULL b)TRUE c)FALSE d)0



    12.main() {

    int i =5,j= 6, z;

    printf(“%d”,i+++j);

    }

    what is the output?

    a)13 b)12 c)11 d)compiler error



    13.main() {

    int i ;

    i = accumulator();

    printf(“%d”,i);

    }

    accumulator(){

    _AX =1000;

    }

    what is output?

    a)1 b)10 c)100 d)1000



    14.main() {

    int i =0;

    while(+(+i--)!= 0)

    i- = i++;

    printf(“%d”,i);

    }

    what is the output?

    a)-1 b)0 c)1 d)will go in an infinite loop



    15.main(){

    int i =3;

    for(; i++=0;)

    printf((“%d”,i);

    }

    what is the output?

    a)1b)2c)1 2 3d)compiler error:L value required.



    16.main(){

    int i = 10, j =20;

    j = i ,j?(i,j)?i :j:j;

    printf(“%d%d”,i,j);

    }what is the output?

    a)20 b)20 c)10 d)10



    17.main(){

    extern i;

    printf(“%d\t”,i);{

    int i =20;

    printf(“%d\t”,i);

    }

    }

    what is output?

    a) “Extern valueof i “ 20 b)Externvalue of i”c)20d)linker Error:unresolved external symbol i



    18.int DIMension(int array[]){

    return sizeof(array/sizeof(int);}

    main(){

    int arr[10];

    printf(“Array dimension is %d”,DIMension(arr));

    }

    what is output?

    a)array dimension is 10 b)array dimension is 1

    c) array dimension is 2 d)array dimension is 5



    19.main(){

    void swap();

    int x = 45, y = 15;

    swap(&x,&y);

    printf(“x = %d y=%d”x,y);

    }

    void swap(int *a, int *b){

    *a^=*b, *b^=*a, *a^ = *b;

    what is the output?

    a) x = 15, y =45 b)x =15, y =15 c)x =45 ,y =15 d)x =45 y = 45



    20.main(){

    int i =257;

    int *iptr =&i;

    printf(“%d%d”,*((char*)iptr),*((char *)iptr+1));

    }

    what is output?

    a)1, 257 b)257 1c)0 0d)1 1



    21.main(){

    int i =300;

    char *ptr = &i;

    *++ptr=2;

    printf(“%d”,i);

    }

    what is output?

    a)556 b)300 c)2 d)302



    22.#include

    main(){

    char *str =”yahoo”;

    char *ptr =str;

    char least =127;

    while(*ptr++)

    least = (*ptr

    printf(“%d”,least);

    }

    what is the output?

    a)0 b)127 c)yahoo d)y



    23.Declare an array of M pointers to functions returing pointers to functions returing pointers to characters.

    a)(*ptr[M]()(char*(*)()); b)(char*(*)())(*ptr[M])()

    c)(char*(*)(*ptr[M]())(*ptr[M]() d)(char*(*)(char*()))(*ptr[M])();



    24.void main(){

    int I =10, j=2;

    int *ip = &I ,*jp =&j;

    int k = *ip/*jp;

    printf(“%d”,k);

    }

    what is the output?

    a)2 b)5 c)10 d)compile error:unexpected end of file in comment started in line 4



    25.main(){

    char a[4] =”GOOGLE”;

    printf(“%s”,a);

    }

    what is the output?

    a)2 b) GOOGLE c) compile error: yoo mant initializers d) linkage error.



    26.For 1MB memory, the number of address lines required

    a)12 b)16 c)20 d)32



    27.There is a circuit using 3 nand gates with 2 inputes and 1 output,f ind the output.

    a) AND b) OR c) XOR d) NAND



    28.what is done for push operation

    a) SP is incremented and then the value is stored.

    b) PC is incremented and then the value is stored.

    c) PC is decremented and then the value is stored.

    d) SP is decremented and then the value is stored.



    29.Memory allocation of variables declared in a program is ------

    a) Allocated in RAM

    b) Allocated in ROM

    c) Allocated in stack

    d) Assigned in registers.



    30.What action is taken when the processer under execution is interrupted by TRAP in 8085MPU?

    a) Processor serves the interrupt request after completing the execution of the current instruction.

    b) processer serves the interrupt request after completing the current task.

    c) processor serves the interrupt immediately.

    d) processor serving the interrupt request depent deprnds upon the priority of the current task under execution.



    31.purpose of PC (program counter)in a microprocessor is ----

    a) To store address of TOS(top of stack)

    b) To store address of next instructions to be executed

    c) count the number of instructions

    d) to store the base address of the stack.



    32.conditional results after execution of an instruction in a microprocess is stored in

    a) register b) accumulator c) flag register d) flag register part of PSW (program status word)



    33.The OR gate can be converted to the NAND function by adding----gate(s)to the input of the OR gate.

    a) NOT b) AND c) NOR d) XOR



    34.In 8051microcontroller ,------has a dual function.

    a) port 3 b) port 2 c) port 1 d) port 0



    35.An 8085 based microprocessor with 2MHz clock frequency,will execute the following chunk of code with how much delay?

    MVI B,38H

    HAPPY: MVI C, FFH

    SADDY: DCR C

    JNZ SADDY

    DCR B

    JNC HAPPY

    a) 102.3 b)114.5 c)100.5 d)120



    36.In 8085 MPU what will be the status of the flag after the execution of the following chunk of code.

    MVI B,FFH

    MOV A,B

    CMA

    HLT

    a)S = 1, Z = 0, CY = 1 b)S = 0, Z = 1, CY = 0

    c) S = 1, Z = 0, CY = 0 d)S = 1, Z = 1 ,CY = 1



    37.A positive going pulse which is always generated when 8085 MPU begins the machine cycle.

    a) RD b) ALE c) WR d) HOLD



    38.when a ----- instruction of 8085 MPU is fetched , its second and third bytes are placed in the W and Z registers.

    a) JMP b) STA c) CALL d) XCHG



    39.what is defined as one subdivision of the operation performed in one clock period.

    a) T- State b) Instruction Cycle c) Machine Cycle d) All of the above



    40.At the end of the following code, what is the status of the flags.

    LXI B, AEC4H

    MOV A,C

    ADD B

    HLT

    a) S = 1, CY = 0, P = 0 , AC = 1 b) S =0 , CY = 1, P = 0,AC = 1

    c) S = 0, CY = 1, P = 0 , AC = 1 d) S = 0, CY = 1, P = 1 , AC = 1


    41.In 8051 micro controller what is the HEX number in the accumulator after the execution of the following code.

    MOV A,#0A5H

    CLR C

    RRC A

    RRC A

    RL A

    RL A

    SWAP A

    a)A6 b)6A c)95 d)A5.



    42.The Pentium processor requires ------------ volts.

    a)9 b)12 c)5 d)24.



    43. The data bus on the Celeron processor is-------bits wide.

    a)64 b)32 c)16 d)128.



    44.K6 processor

    a) Hitachi b) toshiba c) zilog d) AMD.


    45. What is the control word for 8255 PPI,in BSR mode to set bit PC3.
    a)0EH b)0FH c)07H d)06H.


    46.The repeated execution of a loop of code while waiting for an event to occur is called ---------.The cpu is not engaged in any real productive activity during this period,and the process doesn’t progress towards completion.
    a) dead lock b) busy waiting c) trap door d) none.


    47. Transparent DBMS is defined as
    a) A DBMS in which there are no program or user access languages. b) A DBMS which has no cross file capabilities but is user friendly and provides user interface management. c) A DBMS which keeps its physical structure hidden from user d) none.


    48.Either all actions are carried out or none are.users should not have to worry about the effect of incomplete transctions.DBMS ensures this by undoing the actions of incomplete transctions.this property is known as
    a) Aggregation b) atomicity c) association d) data integrity.


    49.------ algorithms determines where in available to load a program. common methods are first fit,next fit,best fit.--------- algorithm are used when memory is full , and one process (or part of a process) needs to be swaped out to accommodate a new program.The ------------- algorithm determines which are the partions to be swaped out.
    a) placement, placement, replacement
    b) replacement, placement, placement
    c) replacement, placement, replacement
    d) placement, replacement, replacement


    50.Trap door is a secret undocumented entry point into a program used to grant access without normal methods of access authentication.A trap is a software interrupt,usually the result of an error condition.
    a)true b)false.


    51. Given a binary search tree,print out the nodes of the tree according t5o post order traversal.

    4

    / \

    2 5

    / \

    1 3


    a)3,2,1,5,4. b)1,2,3,4,5. c)1,3,2,5,4. d)5,3,1,2,4.



    52.which one of the following is the recursive travel technique.

    a)depth first search b)preorder c)breadth first search d)none.



    53.
    54.which of the following needs the requirement to be a binary search tree.

    a) 5

    / \

    2 7

    /

    1



    b) 5

    / \

    6 7


    c) 5

    / \

    2 7

    /\

    1 6



    d) none.



    55.in recursive implementations which of the following is true for saving the state of the steps

    a)as full state on the stack

    b) as reversible action on the stack

    c)both a and b

    d)none


    56.which of the following involves context switch

    a)previliged instruction

    b)floating point exception

    c)system calls

    d)all

    e)none



    57.piggy backing is a technique for

    a)acknowledge

    b)sequence

    c)flow control

    d)retransmission



    58. a functional dependency XY is ___________dependency if removal of any attribute A from X means that the dependency does not hold any more

    a)full functional

    b) multi valued

    c)single valued

    d)none



    59)a relation schema R is in BCNF if it is in ___________and satisfies an additional constraints that for every functional dependency XY,X must be a candidate key
    a)1 NF

    b)2 NF

    c)3 NF

    d)5 NF



    60) a _________sub query can be easily identified if it contains any references to the parent sub query columns in the _________ clause

    A) correlated ,WHERE

    b) nested ,SELECT

    c) correlated,SELECT

    d) none



    61) hybrid devise that combines the features of both bridge and router is known as

    a)router b)bridge c)hub d)brouter



    62) which of the following is the most crucial phase of SDLC

    a)testing b)code generation c) analysys and design d)implementation



    63)to send a data packet using datagram ,connection will be established

    a)no connection is required

    b) connection is not established before data transmission

    c)before data transmission

    d)none



    64)a software that allows a personal computer to pretend as as computer terminal is

    a) terminal adapter

    b)terminal emulation

    c)modem

    d)none



    65) super key is

    a) same as primary key

    b) primary key and attribute

    c) same as foreign key

    d) foreign key and attribute



    66.In binary search tree which traversal is used for ascending order values

    a) Inorder b)preorder c)post order d)none



    67.You are creating an index on ROLLNO colume in the STUDENT table.which statement will you use?

    a) CREATE INDEX roll_idx ON student, rollno;

    b) CREATE INDEX roll_idx FOR student, rollno;

    c) CREATE INDEX roll_idx ON student( rollno);

    d) CREATE INDEX roll_idx INDEX ON student (rollno);





    68.A________class is a class that represents a data structure that stores a number of data objects

    a. container b.component c.base d.derived



    69.Which one of the following phases belongs to the compiler Back-end.

    a. Lexical Analysis b.Syntax Analysis c. Optimization d.Intermediate Representation.



    70.Every context _sensitive language is context_free

    a. true b.false



    71.Input:A is non-empty list of numbers L



    Xß-infinity

    For each item in the list L,do

    If the item>x,then

    Xßthe item

    Return X

    X represents:-

    a)largest number

    b)smallest number

    c)smallest negative number

    d) none



    72.Let A and B be nodes of a heap,such that B is a child of A. the heap must then satisfy the following conditions

    a)key(A)>=key(B)

    b)key(A)

    c)key(A)=key(B)

    d)none



    73.String ,List,Stack,queue are examples of___________



    a)primitive data type

    b)simple data type

    c)Abstract data type

    d)none



    74.which of the following is not true for LinkedLists?

    a)The simplest kind of linked list is a single linked list ,which has one link per node .this link points to the next node in the list,or to a null value or emptylist if it is the last node.

    b)a more sophisticated kind of linked list is a double linkedlist or two way linkedlist .Each node has two links ,one to the previous node and one to the next node.

    c) in a circleLinkedList ,the first and last nodes are linked together.this can be done only for double linked list.

    d) to traverse a circular linkedlist ,u begin at any node and follow the list in either direction until u return to the original node.



    75.sentinel node at the beginning and /or at the end of the linkedlist is not used to store the data

    a) true

    b) false

    Monday

    Questions To Ask The HR

    What kinds of assignments might I expect the first six months on the job?
    How often are performance reviews given?
    Please describe the duties of the job for me.
    What products (or services) are in the development stage now?
    Do you have plans for expansion?
    What are your growth projections for next year?
    Have you cut your staff in the last three years?
    Are salary adjustments geared to the cost of living or job performance?
    Does your company encourage further education?
    How do you feel about creativity and individuality?
    Do you offer flextime?
    What is the usual promotional time frame?
    Does your company offer either single or dual career-track programs?
    What do you like best about your job/company?
    Once the probation period is completed, how much authority will I have over decisions?
    Has there been much turnover in this job area?
    Do you fill positions from the outside or promote from within first?
    Is your company environmentally conscious? In what ways?
    In what ways is a career with your company better than one with your competitors?
    Is this a new position or am I replacing someone?
    What is the largest single problem facing your staff (department) now?
    May I talk with the last person who held this position?
    What qualities are you looking for in the candidate who fills this position?
    What skills are especially important for someone in this position?
    What characteristics do the achievers in this company seem to share?
    Who was the last person that filled this position, what made them successful at it, where are they today, and how may I contact them?
    Is there a lot of team/project work?
    Will I have the opportunity to work on special projects?
    Where does this position fit into the organizational structure?
    How much travel, if any, is involved in this position?
    What is the next course of action? When should I expect to hear from you or should I contact you?

    Tips For HR Interview

    Entering the room
    Prior to the entering the door, adjust your attire so that it falls well.
    Before entering enquire by saying, “May I come in sir/madam”.
    If the door was closed before you entered, make sure you shut the door behind you softly.
    Face the panel and confidently say ‘Good day sir/madam’.
    If the members of the interview board want to shake hands, then offer a firm grip first maintaining eye contact and a smile.
    Seek permission to sit down. If the interviewers are standing, wait for them to sit down first before sitting.
    An alert interviewee would diffuse the tense situation with light-hearted humor and immediately set rapport with the interviewers.

    Enthusiasm
    The interviewer normally pays more attention if you display an enthusiasm in whatever you say.
    This enthusiasm come across in the energetic way you put forward your ideas.
    You should maintain a cheerful disposition throughout the interview, i.e. a pleasant countenance hold s the interviewers interest.

    Humor
    A little humor or wit thrown in the discussion occasionally enables the interviewers to look at the pleasant side of your personality,. If it does not come naturally do not contrive it.
    By injecting humor in the situation doesn’t mean that you should keep telling jokes. It means to make a passing comment that, perhaps, makes the interviewer smile.

    Eye contact
    You must maintain eye contact with the panel, right through the interview. This shows your self-confidence and honesty.
    Many interviewees while answering, tend to look away. This conveys you are concealing your own anxiety, fear and lack of confidence.
    Maintaining an eye contact is a difficult process. As the circumstances in an interview are different, the value of eye contact is tremendous in making a personal impact.

    Be natural
    Many interviewees adopt a stance which is not their natural self.
    It is amusing for interviewers when a candidate launches into an accent which he or she cannot sustain consistently through the interview or adopt mannerisms that are inconsistent with his/her personality.
    Interviewers appreciate a natural person rather than an actor.
    It is best for you to talk in natural manner because then you appear genuine.

    HR Interview Questions Answers

    Tell me about yourself ?
    Start with the present and tell why you are well qualified for the position. Remember that the key to all successful interviewing is to match your qualifications to what the interviewer is looking for. In other words you must sell what the buyer is buying. This is the single most important strategy in job hunting.

    So, before you answer this or any question it's imperative that you try to uncover your interviewer's greatest need, want, problem or goal.

    To do so, make you take these two steps:
    Do all the homework you can before the hr interview to uncover this person's wants and needs (not the generalized needs of the industry or company)

    As early as you can in the interview, ask for a more complete description of what the position entails. You might say: “I have a number of accomplishments I'd like to tell you about, but I want to make the best use of our time together and talk directly to your needs. To help me do, that, could you tell me more about the most important priorities of this position? All I know is what I (heard from the recruiter, read in the classified ad, etc.)”

    Then, ALWAYS follow-up with a second and possibly, third question, to draw out his needs even more. Surprisingly, it's usually this second or third question that unearths what the interviewer is most looking for.

    You might ask simply, "And in addition to that?..." or, "Is there anything else you see as essential to success in this position?:

    This process will not feel easy or natural at first, because it is easier simply to answer questions, but only if you uncover the employer's wants and needs will your answers make the most sense. Practice asking these key questions before giving your answers, the process will feel more natural and you will be light years ahead of the other job candidates you're competing with.

    After uncovering what the employer is looking for, describe why the needs of this job bear striking parallels to tasks you've succeeded at before. Be sure to illustrate with specific examples of your responsibilities and especially your achievements, all of which are geared to present yourself as a perfect match for the needs he has just described.

    What are your greatest strengths ?

    You know that your key strategy is to first uncover your interviewer's greatest wants and needs before you answer questions. And from Question 1, you know how to do this.

    Prior to any interview, you should have a list mentally prepared of your greatest strengths. You should also have, a specific example or two, which illustrates each strength, an example chosen from your most recent and most impressive achievements.

    You should, have this list of your greatest strengths and corresponding examples from your achievements so well committed to memory that you can recite them cold after being shaken awake at 2:30AM.

    Then, once you uncover your interviewer's greatest wants and needs, you can choose those achievements from your list that best match up.

    As a general guideline, the 10 most desirable traits that all employers love to see in their employees are:

    A proven track record as an achiever...especially if your achievements match up with the employer's greatest wants and needs.

    Intelligence...management "savvy".

    Honesty...integrity...a decent human being.

    Good fit with corporate culture...someone to feel comfortable with...a team player who meshes well with interviewer's team.

    Likeability...positive attitude...sense of humor.

    Good communication skills.

    Dedication...willingness to walk the extra mile to achieve excellence.

    Definiteness of purpose...clear goals.

    Enthusiasm...high level of motivation.

    Confident...healthy...a leader.

    What are your greatest weaknesses ?

    Disguise a strength as a weakness.

    Example: “I sometimes push my people too hard. I like to work with a sense of urgency and everyone is not always on the same wavelength.”

    Drawback: This strategy is better than admitting a flaw, but it's so widely used, it is transparent to any experienced interviewer.

    BEST ANSWER: (and another reason it's so important to get a thorough description of your interviewer's needs before you answer questions): Assure the interviewer that you can think of nothing that would stand in the way of your performing in this position with excellence. Then, quickly review you strongest qualifications.

    Example: “Nobody's perfect, but based on what you've told me about this position, I believe I' d make an outstanding match. I know that when I hire people, I look for two things most of all. Do they have the qualifications to do the job well, and the motivation to do it well? Everything in my background shows I have both the qualifications and a strong desire to achieve excellence in whatever I take on. So I can say in all honesty that I see nothing that would cause you even a small concern about my ability or my strong desire to perform this job with excellence.”

    Alternate strategy (if you don't yet know enough about the position to talk about such a perfect fit):

    Instead of confessing a weakness, describe what you like most and like least, making sure that what you like most matches up with the most important qualification for success in the position, and what you like least is not essential.

    Example: Let's say you're applying for a teaching position. “If given a choice, I like to spend as much time as possible in front of my prospects selling, as opposed to shuffling paperwork back at the office. Of course, I long ago learned the importance of filing paperwork properly, and I do it conscientiously. But what I really love to do is sell (if your interviewer were a sales manager, this should be music to his ears.)

    Tell me about something you did – or failed to do – that you now feel a little ashamed of ?
    As with faults and weaknesses, never confess a regret. But don’t seem as if you’re stonewalling either.

    Best strategy: Say you harbor no regrets, then add a principle or habit you practice regularly for healthy human relations.

    Example: Pause for reflection, as if the question never occurred to you. Then say to hr, “You know, I really can’t think of anything.” (Pause again, then add): “I would add that as a general management principle, I’ve found that the best way to avoid regrets is to avoid causing them in the first place. I practice one habit that helps me a great deal in this regard. At the end of each day, I mentally review the day’s events and conversations to take a second look at the people and developments I’m involved with and do a double check of what they’re likely to be feeling. Sometimes I’ll see things that do need more follow-up, whether a pat on the back, or maybe a five minute chat in someone’s office to make sure we’re clear on things…whatever.”

    “I also like to make each person feel like a member of an elite team, like the Boston Celtics or LA Lakers in their prime. I’ve found that if you let each team member know you expect excellence in their performance…if you work hard to set an example yourself…and if you let people know you appreciate and respect their feelings, you wind up with a highly motivated group, a team that’s having fun at work because they’re striving for excellence rather than brooding over slights or regrets.”

    Why are you leaving (or did you leave) this position ?
    (If you have a job presently tell the hr)

    If you’re not yet 100% committed to leaving your present post, don’t be afraid to say so. Since you have a job, you are in a stronger position than someone who does not. But don’t be coy either. State honestly what you’d be hoping to find in a new spot. Of course, as stated often before, you answer will all the stronger if you have already uncovered what this position is all about and you match your desires to it.

    (If you do not presently have a job tell the hr.)

    Never lie about having been fired. It’s unethical – and too easily checked. But do try to deflect the reason from you personally. If your firing was the result of a takeover, merger, division wide layoff, etc., so much the better.

    But you should also do something totally unnatural that will demonstrate consummate professionalism. Even if it hurts , describe your own firing – candidly, succinctly and without a trace of bitterness – from the company’s point-of-view, indicating that you could understand why it happened and you might have made the same decision yourself.

    Your stature will rise immensely and, most important of all, you will show you are healed from the wounds inflicted by the firing. You will enhance your image as first-class management material and stand head and shoulders above the legions of firing victims who, at the slightest provocation, zip open their shirts to expose their battle scars and decry the unfairness of it all.

    For all prior positions:

    Make sure you’ve prepared a brief reason for leaving. Best reasons: more money, opportunity, responsibility or growth.

    Thursday

    whole testpaper of ashok leyland(Non-IT)

    ASHOK LEYLAND Test Paper 2006

    The test consisted of 3 sections 50 or 30 questions each. all were objective questions havin 4 or 5 choices.

    section 1 - basic maths (30 min)

    questions are easy. the paper is basically a test of fundamentals & speed.
    consisted of questions on basic maths that you learn in 12th n first year of engineering.
    just know the basics of functions, sets & relations well.
    definitions of stuff like order of ordinary differential equation bcoz u r asked to identify a given differential equation.
    know basics of geometry well and funda of folds i.e. a given piece of paper if folded along given lines will give wat shape.
    fundas of equation solving, determinants & matrices. the determinant usually is zero magnitude.

    section 2 - basic mechanical & general Engineering 40 min

    this section separates the best from the rest. questions are only concept based.
    all subjects are covered in one way or other.
    know the fundas of pulleys n other basic mechanics stuff.
    if u havent studied automobile engineering then just go thru functions of fundamental stuff like differential, overdrive, gears, clutch.
    know wat type motors are used in machines like Lathe etc.
    one question was on crystal structure of graphite( Ans: HCP)

    section 3 - reasoning 30min

    this was the toughest in terms of time management.
    its virtually impossible to solve even 100% questions even if ur CAT preps are at peak. i put blind guesses the last minute for abt 15-20 questions.
    the questions were basically finding pattern, breaking codes n the fundas of assumptions, conclusions .. the one u have in CAT.

    I am not sure if they have a section wise cutoff or overall cutoff. but all ppl above the minimum cutoff are shortlisted for interview.
    It was raining heavily so none of were in either formals or wid our files. but the HR was cool. he said dont bother for dresses.
    As for the files he said they are not needed if u can explain ur project or training well.
    so there i was wearing a tight T-shirt n faded jeans facin my biggest interview till date.

    interviews were Tech+HR combined 20-40mins duration each.
    stress was on how much you have learnty frm ur summer project n how much can u relate it to the real stuff.

    I was the last person in.

    First the HR tried to corner me. He told me why i was not angry since they made me wait for so long. (i turn came at 2:30pm whereas the time given by them was 1:00pm)
    He asked me if my time was so worthless that i can be made to wait any amt of time by anytime. but i countered him by saying that “waitin for the Interview by your company is worth the wait”.
    He seemed very impressed. They then asked me a few tech questions which i answered well. then came my masterstroke. i told them i hadnt learnt Automobile engineering as it was in the final yeat.
    I told the surprisded lot that I had learnt by myself thru internet. then they asked me a lot of questions regarding Automobile engineering n i just kept surprising them wid my answers.
    Then a few out of syllabus questions frm Manufacturing processes which i answered n pointed that the they were not in my syllabus but i had read abt them in the books. they were again surprised
    n commented that i was way ahead of my course. Then asked abt wat n where did i do my summer projects. i gave a brief introduction abt both of them. I told them i knew “FLUENT”- a CFD software which surprised them again.them again.
    Then they asked me my first choice i.e. R&D or Production or Marketing. I answered even b4 he finished “R&D”. Then he asked me the second choice: “No second option”. Then they adviced me for abt 5mins on that. In the end i told that i was open for the first two but not marketing.
    Then they asked few HR questions like family background n other usual stuff. In the end they asked if i wanted to ask them sumthin.
    I asked them abt the performance appraisal in their company. its very important that u ask them a good question. use the Internet n find out good q’s.
    The HR was specially very impressed by me. He told me i was the best n it was a great performance.

    Wednesday

    C Aptitude Questions and Answers

    Predict the output or error(s) for the following:
    1. main()
    {
    int i=-1,j=-1,k=0,l=2,m;
    m=i++&&j++&&k++||l++;
    printf("%d %d %d %d %d",i,j,k,l,m);
    }

    Answer:
    0 0 1 3 1

    Explanation :
    Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator has higher priority over the logical OR (||) operator. So the expression ‘i++ && j++ && k++’ is executed first. The result of this expression is 0 (-1 && -1 && 0 = 0). Now the expression is 0 || 2 which evaluates to 1 (because OR operator always gives 1 except for ‘0 || 0’ combination- for which it gives 0). So the value of m is 1. The values of other variables are also incremented by 1.

    2. main()
    {
    char *p;
    printf("%d %d ",sizeof(*p),sizeof(p));
    }

    Answer:
    1 2

    Explanation:
    The sizeof() operator gives the number of bytes taken by its operand. P is a character pointer, which needs one byte for storing its value (a character). Hence sizeof(*p) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof(p) gives 2.

    3. main()
    {
    int i=3;
    switch(i)
    {
    default:printf("zero");
    case 1: printf("one");
    break;
    case 2:printf("two");
    break;
    case 3: printf("three");
    break;
    }
    }

    Answer :
    three

    Explanation :
    The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.

    4. main()
    {
    printf("%x",-1<<4);
    }

    Answer:
    fff0

    Explanation :
    -1 is internally represented as all 1's. When left shifted four times the least significant 4 bits are filled with 0's.The %x format specifier specifies that the integer value be printed as a hexadecimal value.

    5. main()
    {
    char string[]="Hello World";
    display(string);
    }
    void display(char *string)
    {
    printf("%s",string);
    }

    Answer:
    Compiler Error : Type mismatch in redeclaration of function display

    Explanation :
    In third line, when the function display is encountered, the compiler doesn't know anything about the function display. It assumes the arguments and return types to be integers, (which is the default type). When it sees the actual function display, the arguments and type contradicts with what it has assumed previously. Hence a compile time error occurs.

    6. main()
    {
    int c=- -2;
    printf("c=%d",c);
    }

    Answer:
    c=2;

    Explanation:
    Here unary minus (or negation) operator is used twice. Same maths rules applies, ie. minus * minus= plus.
    Note:
    However you cannot give like --2. Because -- operator can only be applied to variables as a decrement operator (eg., i--). 2 is a constant and not a variable.

    7. #define int char
    main()
    {
    int i=65;
    printf("sizeof(i)=%d",sizeof(i));
    }

    Answer:
    sizeof(i)=1

    Explanation:
    Since the #define replaces the string int by the macro char

    8. main()
    {
    int i=10;
    i=!i>14;
    Printf ("i=%d",i);
    }

    Answer:
    i=0

    Explanation:
    In the expression !i>14 , NOT (!) operator has more precedence than ‘ >’ symbol. ! is a unary logical operator. !i (!10) is 0 (not of true is false). 0>14 is false (zero).