Thursday, 26 July 2012

C interview Questions


 C Interview Questions 














Interview Preparation Tips


Interview Tips: 


       Using the FD Edge Resume Optimization Strategy, this question is straightforward. Talk about each section of your resume in a linear, clear, enthusiastic way. Do not go overly in-depth into any one item, but do not remain too superficial either. Touch on your academic, professional, leadership, technical, and personal qualifications, concluding with a statement about why these experiences are important for your industry.
Don’t let the wording of this question limit your response. Every candidate will have experience and leadership positions. What sets someone apart is a unique personality and interests. An interviewer ultimately wants to know if you are a good cultural fit for the company. Let your personality shine through and talk about the things you do outside of school and work.

Sunday, 15 July 2012

JAVA .NET FAQ’S


JAVA  .NET FAQ’S
1. What is java.net?
java.net is a premier web-based, open community created to facilitate Java™ technology collaboration in applied areas of technology and industry solutions. java.net is a central gathering place for Java technology enthusiasts and existing communities across industries, platforms, and interest groups.
2. What is the goal of java.net?
The goal is to expand the Java™ technology portfolio of applications, tools, and services by promoting conversation and collaboration around development of practical applications across industry groups.
3. What will developers find on java.net?
On java.net, developers can find and post material related to their specialized needs. Through a variety of collaborative tools such as wikis, weblogs, discussion forums, mail lists, and RSS newsfeeds, as well as traditional open source tools like CVS, java.net allows developers to come to one place to find out the latest news and opinions, have conversations with other developers who share specific interests, and ultimately engage in efficient development efforts using Java™ technology.
4. Is java.net a Sun web site?
java.net was launched by Sun and will be championed and financially sponsored by Sun; the majority of the content will come from companies and individuals outside of Sun.
5. How will Sun benefit from java.net?
A thriving java.net community benefits all active participants, including Sun. By participating in java.net communities, Sun can create better products, establish new business relationships and partnerships, and engage more closely with developers who are committed to using Java™ technology in innovative and creative ways.
6. How is O'Reilly Media involved in java.net?
In order to ensure the Java™ technology community is broadly represented, Sun has arranged for renowned publisher O'Reilly Media (www.oreilly.com) to be the feature editor for java.net. O'Reilly will solicit and manage the news features and highlighted webloggers that are presented on the opening pages of java.net.
7. How is CollabNet involved in java.net?

A to Z Html Tags


List of HTML Tags

        <!-->--Comments And Server Side Includes
        <!DOCTYPE>--Starting An HTML Page
        <A>--Creating A Hyperlink Or Anchor
        <ABBR>--Displaying Abbreviations
        <ACRONYM>--Displaying Acronyms
        <ADDRESS>--Displaying An Address
        <APPLET>--Embedding Applets In Web Pages
        <AREA>--Creating Clickable Regions In Image Maps
        <B>--Creating Bold Text
        <BASE>--Setting The Base For Hyperlinks
        <BASEFONT>--Setting The Base Font
        <BDO>--Overriding The Bidirectional Character Algorithm
        <BGSOUND>--Adding Background Sounds
        <BIG>--Creating Big Text
        <BLINK>--Making Text Blink
        <BLOCKQUOTE>Indenting Quotations
        <BODY>--Creating A Web Page's Body

Java script meterial


JavaScript 

What is JavaScript ?
JavaScript is a scripting language produced by Netscape for use within HTML Web pages.      
JavaScript started life as LiveScript, but Netscape changed the name, possibly because of the excitement being generated by Java.to JavaScript. JavaScript made its first appearance in Netscape 2.0 in 1995 with a name LiveScript.
JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.
The general-purpose core of the language has been embedded in Netscape, Internet Explorer, and other web browsers
  • JavaScript was designed to add interactivity to HTML pages
  • JavaScript is a scripting language
  • A scripting language is a lightweight programming language
  • JavaScript is usually embedded directly into HTML pages
  • JavaScript is an interpreted language (means that scripts execute without preliminary compilation)

Are Java and JavaScript the Same?

NO!
Java and JavaScript are two completely different languages in both concept and design!
Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++.

What can a JavaScript Do?

  • JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages
  • JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>") can write a variable text into an HTML page
  • JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element
  • JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element
  • JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing
  • JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser
  • JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer

Client-side JavaScript:

Client-side JavaScript is the most common form of the language. The script should be included in or referenced by an HTML document for the code to be interpreted by the browser.
It means that a web page need no longer be static HTML, but can include programs that interact with the user, control the browser, and dynamically create HTML content.
The JavaScript client-side mechanism features many advantages over traditional CGI server-side scripts. For example, you might use JavaScript to check if the user has entered a valid e-mail address in a form field.
The JavaScript code is executed when the user submits the form, and only if all the entries are valid they would be submitted to the Web Server.
JavaScript can be used to trap user-initiated events such as button clicks, link navigation, and other actions that the user explicitly or implicitly initiates.

Advantages of JavaScript:

The merits of using JavaScript are:

java script inteview Question with answers


1.      What is JavaScript?
A1: JavaScript is a general-purpose programming language designed to let programmers of all skill levels control the behavior of software objects. The language is used most widely today in Web browsers whose software objects tend to represent a variety of HTML elements in a document and the document itself. But the language can be--and is--used with other kinds of objects in other environments. For example, Adobe Acrobat Forms uses JavaScript as its underlying scripting language to glue together objects that are unique to the forms generated by Adobe Acrobat. Therefore, it is important to distinguish JavaScript, the language, from the objects it can communicate with in any particular environment. When used for Web documents, the scripts go directly inside the HTML documents and are downloaded to the browser with the rest of the HTML tags and content. 

A2:JavaScript is a platform-independent,event-driven, interpreted client-side scripting and programming language developed by Netscape Communications Corp. and Sun Microsystems.
2.      How is JavaScript different from Java? 
JavaScript was developed by Brendan Eich of Netscape; Java was developed at Sun Microsystems. While the two languages share some common syntax, they were developed independently of each other and for different audiences. Java is a full-fledged programming language tailored for network computing; it includes hundreds of its own objects, including objects for creating user interfaces that appear in Java applets (in Web browsers) or standalone Java applications. In contrast, JavaScript relies on whatever environment it's operating in for the user interface, such as a Web document's form elements. 
JavaScript was initially called LiveScript at Netscape while it was under development. A licensing deal between Netscape and Sun at the last minute let Netscape plug the "Java" name into the name of its scripting language. Programmers use entirely different tools for Java and JavaScript. It is also not uncommon for a programmer of one language to be ignorant of the other. The two languages don't rely on each other and are intended for different purposes. In some ways, the "Java" name on JavaScript has confused the world's understanding of the differences between the two. On the other hand, JavaScript is much easier to learn than Java and can offer a gentle introduction for newcomers who want to graduate to Java and the kinds of applications you can develop with it.
3.      What’s relationship between JavaScript and ECMAScript? 
ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3. 
4.      How do you submit a form using Javascript? 
Use document.forms[0].submit();
(0 refers to the index of the form – if you have more than one form in a page, then the first one has the index 0, second has index 1 and so on).
5.      How do we get JavaScript onto a web page? 

Thursday, 12 July 2012

Importance Of C


                                                                 C
C is a robust language. means rich set of built in functions and operators  can be used to write any complex program.
Programs written in C are efficent and fast.
There are 32 keywords and several standard functions are available which can be used for developing program.
c is highly portable. this means that c programs written for one computer can be run on another with litte or no modification.
c programing language is structred programming language. means  data can be written in module or function or blocks.
a proper collection of these modules make a complete program.
A simple Program
----------------------------

#include<stdio.h>
main()
{
/* printing begin */
printf(""This is my first program");

}  /* this is main block closed */

Commonly Used Struts Tags in Java


Commonly Used Struts Tags
Struts Studio comes with support for the three most common Struts JSP tag libraries:
For the tags in these libraries, the tables below show the names (without the required prefixes), whether the tag is for an empty element (<emptyElementTag /> versus <elementTag>...</elementTag>), required attributes, and optional attributes.
Each of these tag names must be prefixed with bean: when using.
tag name
empty
required attributes
optional attributes
cookie
yes
id, name
multiple, value
define
yes
id
name, property, scope, toScope, type, value
header
yes
id, name
multiple, value
include
yes
id
anchor, forward, href, name, page, transaction
message
yes

arg0, arg1, arg2, arg3, arg4, bundle, key, locale, name, property, scope
page
yes
id, property

parameter
yes
id, name
multiple, value
resource
yes
id, name
input
size
yes
id
collection, name, property, scope
struts
yes
id
formBean, forward, mapping
write
yes

bundle, filter, format, formatKey, ignore, locale, property, scope

Vocabulary And Critical Reasoning


 
       part A   

  Vocabulary(synonyms) 40 Questions

1. To merry = Enjoy
2. To Alienate = abandon
3. To Solicit = Humble
4. To Heep =to gather
5. Cargo = load,luggage
6. Momentary = for small time
7. Volume = quantity
8. To Veer =
9. To Admonish=
10. To Meager = small,little
11. To lattitude,
12. Latent =
13. To Covet = To desire
14. To Discretion =
15. Potential = ability

JDBC Questions and Answers


                        JDBC (java database connectivity)  
                        ===============================

1. What is JDBC ? what are its advantages ?

A. It is an API .The latest version of jdbc api is (3.0).
   The JDBC 3.0 API is divided into two packages:
   (1) java.sql and (2) javax.sql.
   Both packages are included in the J2SE and J2EE platforms.
  
   advantages:
   ---------------
      The JDBC API can be used to interact with multiple data sources in a    distributed, heterogeneous environment.
      It  can connect to any of the database from java language.
      It can switch over to any backend database without changing java code or      by minute changes.

2. How many JDBC Drivers are there ? what are they?
A. There are 4 types of JDBC drivers.
   a. JDBC-ODBC Bridge Driver(Type-1 driver)
   b. Native API Partly Java Driver(Type-2 driver)
   c. Net protocol pure Java Driver(Type-3 driver)
   d. Native protocol Pure Java Driver(Type-4 driver)

3. Explain about JDBC-ODBC driver(Type-1) ? When this type of driver is used ?
A. In this mechanism the flow of execution will be
  
   Java code(JDBC API)<------>JDBC-ODBC bridge driver<------->ODBC API<-------      >ODBC Layer<-------->DataBase

   This type of JDBC Drivers provides a bridge between JDBC API and ODBC API.
   This Bridge(JDBC-ODBC bridge)translates standard JDBC calls to Corresponding                  
   ODBC Calls, and send them to ODBC database via ODBC Libraries.

   The JDBC API is based on ODBC API.
   ODBC(Open Database Connectivity)is Microsoft's API for Database drivers.
   ODBC is based on X/Open Call Level Interface(CLI)specification for database 
   access.

   The URL and class to be loaded for this type of driver are

   Class :- sun.jdbc.odbc.JdbcOdbcDriver
   URL      :- jdbc:odbc:dsnname

4. Explain about Type-2 driver ? When this type of driver is used ?

Sunday, 8 July 2012

java interview Question and Answers

JAVA
1.        What is the difference between procedural and object-oriented programs?- a) In procedural program, programming logic follows certain procedures and the instructions are executed one after another. In OOP program, unit of program is object, which is nothing but combination of data and code. b) In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in turn assures the security of the code.
2.       What are Encapsulation, Inheritance and Polymorphism?- Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse. Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions.
3.       What is the difference between Assignment and Initialization?- Assignment can be done as many times as desired whereas initialization can be done only once.
4.       What is OOPs?- Object oriented programming organizes a program around its data, i. e. , objects and a set of well defined interfaces to that data. An object-oriented program can be characterized as data controlling access to code.
5.        What are Class, Constructor and Primitive data types?- Class is a template for multiple objects with similar features and it is a blue print for objects. It defines a type of object according to the data the object can hold and the operations the object can perform. Constructor is a special kind of method that determines how an object is initialized when created. Primitive data types are 8 types and they are: byte, short, int, long, float, double, boolean, char.
6.       What is an Object and how do you allocate memory to it?- Object is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data. When an object is created using new operator, memory is allocated to it.
7.        What is the difference between constructor and method?- Constructor will be automatically invoked when an object is created whereas method has to be called explicitly.
8.       What are methods and how are they defined?- Methods are functions that operate on instances of classes in which they are defined. Objects can communicate with each other using methods and can call methods in other classes. Method definition has four parts. They are name of the method, type of object or primitive type the method returns, a list of parameters and the body of the method. A method’s signature is a combination of the first three parts mentioned above.
9.       What is the use of bin and lib in JDK?- Bin contains all tools such as javac, appletviewer, awt tool, etc., whereas lib contains API and all packages.
10.     What is casting?- Casting is used to convert the value of one type to another.
11.      How many ways can an argument be passed to a subroutine and explain them?- An argument can be passed in two ways. They are passing by value and passing by reference. Passing by value: This method copies the value of an argument into the formal parameter of the subroutine. Passing by reference: In this method, a reference to an argument (not the value of the argument) is passed to the parameter.
12.     What is the difference between an argument and a parameter?- While defining method, variables passed in the method are called parameters. While using those methods, values passed to those variables are called arguments.
13.     What are different types of access modifiers?

How Web Servers Work




Photo courtesy Shopping.com
IBM Netfinity 5500 8660 Server
Have you ever wondered about the mechanisms that delivered this page to you? Chances are you are sitting at a computer right now, viewing this page in a browser. So, when you clicked on the link for this page, or typed in its URL (uniform resource locator), what happened behind the scenes to bring this page onto your screen?
If you've ever been curious about the process, or have ever wanted to know some of the specific mechanisms that allow you to surf the Internet, then read on. In this article, you will learn how Web servers bring pages into your home, school or office. Let's get started!
The Basic Process
Let's say that you are sitting at your computer, surfing the Web, and you get a call from a friend who says, "I just read a great article! Type in this URL and check it out. It's at http://computer.howstuffworks.com/web-server.htm." So you type that URL into your browser and press return. And magically, no matter where in the world that URL lives, the page pops up on your screen.

Frequently Asked Questions on OOPS



How do you write a program which produces its own source code as its output? 
How can I find the day of the week given the date? 
Why doesn't C have nested functions? 
What is the most efficient way to count the number of bits which are set in a value? 
How can I convert integers to binary or hexadecimal? 
How can I call a function, given its name as a string? 
How do I access command-line arguments? 
How can I return multiple values from a function? 
How can I invoke another program from within a C program? 
How can I access memory located at a certain address? 
How can I allocate arrays or structures bigger than 64K? 

Exercise on C++



 1. Design a small program without the class concept for the functionality of a cashier to accept cash and to accept money and behave accordingly. The cashier is expected to call the signature verify authority (In this case a unique id generated by a random number generator and stored in some global entity) to verify the signature of the customer. If he is a valid customer then the cashier should accept the cheque or the money and deposit it in a global variable.

2. List down the problem faced in designing such kind of problem???

3. Try down the same problem with the concept of class and object and design a small bank.

4. If you require efficiency for any simple functions, will you treat the function as normal function or not. What is the appropriate step you should take to such kind of problems (In the above case signature function).

5. Create a class with public, private data members and function members. Create an object of this  class and see what kind of compiler messages you get when you try to access all the class members.

6. Write a struct called Lib that contains three string objects a, b, and c. In main( ) create a Lib object called x and assign to x.a, x.b, and x.c. Print out the values. Now replace a, b, and c with an array of string s[3]. Show that your code in main( ) breaks as a result of the change. Now create a class called Libc, with private string objects a, b, and c, and member functions seta( ), geta( ), setb( ), getb( ), setc( ), and getc( ) to set and get the values. Write main( ) as before. Now change the private string objects a, b, and c to a private array of string s[3]. Show that the code in main( ) does not break as a result of the change.

7. Write two classes, each of which has a member function that takes a pointer to an object of the other class. Create instances of both objects in main( ) and call the aforementioned member function in each class.

c++ Programme Names


Computer Programs in C
General Programs
1.      Write a program to print your Address.
2.      Write a program to print your Bio Data.
3.      Write a program to add, multiply, subtract, division, mod of 2 numbers.
4.      Write a program to swap two numbers using 3 variables.
5.      Write a program to calculate profit of a product.
6.      Write a program to calculate simple interest.
7.      Compute Area of a Triangle given all its sides.
8.      Extracting a Unit’s digit of a given integer number.

c++ Interview Questions With Answers


C++ 

Note : All the programs are tested under Turbo C++ 3.0, 4.5 and Microsoft VC++ 6.0 compilers. 
It is assumed that,
Ø  Programs run under Windows environment,
Ø  The underlying machine is an x86 based system,
Ø  Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).

1) class Sample
{
public:
        int *ptr;
        Sample(int i)
        {
        ptr = new int(i);
        }
        ~Sample()
        {
        delete ptr;
        }
        void PrintVal()
        {
        cout << "The value is " << *ptr;
        }
};
void SomeFunc(Sample x)
{
cout << "Say i am in someFunc " << endl;
}
int main()
{
Sample s1= 10;
SomeFunc(s1);
s1.PrintVal();
}
Answer:
Say i am in someFunc
Null pointer assignment(Run-time error)
Explanation:
As the object is passed by value to SomeFunc  the destructor of the object is called when the control returns from the function. So when PrintVal is called it meets up with ptr  that has been freed.The solution is to pass the Sample object  by reference to SomeFunc:

void SomeFunc(Sample &x)
{
cout << "Say i am in someFunc " << endl;
}
because when we pass objects by refernece that object is not destroyed. while returning from the function.

2)      Which is the parameter that is added to every non-static member function when it is called?
Answer:
            ‘this’ pointer

3) class base
        {
        public:
        int bval;
        base(){ bval=0;}
        };

class deri:public base
        {
        public:
        int dval;
        deri(){ dval=1;}
        };
void SomeFunc(base *arr,int size)
{
for(int i=0; i<size; i++,arr++)
        cout<<arr->bval;
cout<<endl;
}

int main()
{
base BaseArr[5];
SomeFunc(BaseArr,5);
deri DeriArr[5];
SomeFunc(DeriArr,5);
}

Answer:
 00000
 01010
Explanation: