Pay Scale For Freshers in India IT

10 02 2009

Pay Scale For Freshers in India IT Company- Pay in LPA
Accenture-2.1
Adobe-5.7
Amazon-7.5
Attrenta-4.8
Caritor-2.0
CISCO-4.0
Computer Associates-4.5
CTS-2.1
DE Shaw-6.0
Deloitte-7.0
Fiorano-5.0
Flextronics (HSS)-3.0
Google-12.0
GE-3.0
HCL-2.0
Hexaware-2.1
IBM-2.5
Impulsesoft-4.5
Interra Systems-4.6
Induslogic-4.2
Infosys-1.8
Kanbay-2.25
Kritical-5.6
MBT-2.5
Microsoft-7.8
Mindtree-3.0
Motorola-3.6
Oracle-4.2
Patni(PCS)-1.7
Perot Systems-2.5
Polaris-2.0
SAP Labs-4.0
Samsung-4.6
Satyam-2.25
STM-4.5
Sun Microsystems-5.0
Syntel-2.05
Tata Elxs-1.9
Tavant-3.6
TCS-1.8
T-Mobile-8.0
Trilogy-7.5
Verizon-3.0
Virtusa-2.4
Wipro-2.1

Here you can find Latest Salery Package of Freshers in India. We are giving you this detials only for infromation which you can know what the salery given by TOP IT Companies. Before you join any company you well know what you will get there.





Testing Questions and Answers

10 02 2009

Testing Questions and Answers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. What makes a good test engineer? 2
2. What makes a good software QA engineer? 2
3. What makes a good QA or Test manager? 2
4. What’s the role of documentation in QA? 3
5. What’s the big deal about ‘requirements’? 3
6. What steps are needed to develop and run software tests? 3
7. What’s a ‘test plan’? 4
8. What’s a ‘test case’? 6
9. What should be done after a bug is found? 6
10. What is ‘configuration management’? 8
11. What if the software is so buggy it can’t really be tested at all? 8
12. How can it be known when to stop testing? 8
13. What if there isn’t enough time for thorough testing? 8
14. What if the project isn’t big enough to justify extensive testing? 9
15. What can be done if requirements are changing continuously? 9
16. What if the application has functionality that wasn’t in the
requirements? 10
17. How can Software QA processes be implemented without stifling
productivity? 11
18. What if an organization is growing so fast that fixed QA processes
are impossible? 11
19. How does a client’server environment affect testing? 11
20. How can World Wide Web sites be tested? 11
21. How is testing affected by object-oriented designs? 13
22. What is Extreme Programming and what’s it got to do with testing ? 13

1. What makes a good test engineer?
? A good test engineer has a ‘test to break’ attitude, an ability to
take the point of view of the customer, a strong desire for quality,
and an attention to detail.
? Tact and diplomacy are useful in maintaining a cooperative
relationship with developers, and an ability to communicate with both
technical (developers) and non-technical (customers, management)
people is useful.
? Previous software development experience can be helpful as it
provides a deeper understanding of the software development process,
gives the tester an appreciation for the developers’ point of view,
and reduce the learning curve in automated test tool programming.
? Judgement skills are needed to assess high-risk areas of an
application on which to focus testing efforts when time is limited.
2. What makes a good software QA engineer?
? The same qualities a good tester has are useful for a QA engineer.
? Additionally, they must be able to understand the entire software
development process and how it can fit into the business approach and
goals of the organization.
? Communication skills and the ability to understand various sides of
issues are important.
? In organizations in the early stages of implementing QA processes,
patience and diplomacy are especially needed.
? An ability to find problems as well as to see ‘what’s missing’ is
important for inspections and reviews.
3. What makes a good QA or Test manager?
? A good QA, test, or QA/Test (combined) manager should:
? be familiar with the software development process
? be able to maintain enthusiasm of their team and promote a positive
atmosphere, despite what is a somewhat ‘negative’ process (e.g.,
looking for or preventing problems)
? be able to promote teamwork to increase productivity
? be able to promote cooperation between software, test, and QA engineers
? have the diplomatic skills needed to promote improvements in QA
processes
? have the ability to withstand pressures and say ‘no’ to other
managers when quality is insufficient or QA processes are not being
adhered to
? have people judgement skills for hiring and keeping skilled personnel
? be able to communicate with technical and non-technical people,
engineers, managers, and customers.
? be able to run meetings and keep them focused
4. What’s the role of documentation in QA?

? Critical. (Note that documentation can be electronic, not
necessarily paper.)
? QA practices should be documented such that they are repeatable.
? Specifications, designs, business rules, inspection reports,
configurations, code changes, test plans, test cases, bug reports,
user manuals, etc. should all be documented.
? There should ideally be a system for easily finding and obtaining
documents and determining what documentation will have a particular
piece of information.
? Change management for documentation should be used if possible.

5. What’s the big deal about ‘requirements’?

? One of the most reliable methods of insuring problems, or failure,
in a complex software project is to have poorly documented
requirements specifications.
? Requirements are the details describing an application’s
externally-perceived functionality and properties.
? Requirements should be clear, complete, reasonably detailed,
cohesive, attainable, and testable. A non-testable requirement would
be, for example, ‘user-friendly’ (too subjective).
? A testable requirement would be something like ‘the user must enter
their previously-assigned password to access the application’.
? Determining and organizing requirements details in a useful and
efficient way can be a difficult effort; different methods are
available depending on the particular project.
? Many books are available that describe various approaches to this task.
? Care should be taken to involve ALL of a project’s significant
‘customers’ in the requirements process.
? ‘Customers’ could be in-house personnel or out, and could include
end-users, customer acceptance testers, customer contract officers,
customer management, future software maintenance engineers,
salespeople, etc.
? Anyone who could later derail the project if their expectations
aren’t met should be included if possible.
? Organizations vary considerably in their handling of requirements
specifications.
? Ideally, the requirements are spelled out in a document with
statements such as ‘The product shall.’.
? ‘Design’ specifications should not be confused with ‘requirements’;
design specifications should be traceable back to the requirements.
? In some organizations requirements may end up in high level project
plans, functional specification documents, in design documents, or in
other documents at various levels of detail.
? No matter what they are called, some type of documentation with
detailed requirements will be needed by testers in order to properly
plan and execute tests.
? Without such documentation, there will be no clear-cut way to
determine if a software application is performing correctly.

6. What steps are needed to develop and run software tests?

The following are some of the steps to consider:
? Obtain requirements, functional design, and internal design
specifications and other necessary documents
? Obtain budget and schedule requirements
? Determine project-related personnel and their responsibilities,
reporting requirements, required standards and processes (such as
release processes, change processes, etc.)
? Identify application’s higher-risk aspects, set priorities, and
determine scope and limitations of tests
? Determine test approaches and methods – unit, integration,
functional, system, load, usability tests, etc.
? Determine test environment requirements (hardware, software,
communications, etc.)
? Determine testware requirements (record/playback tools, coverage
analyzers, test tracking, problem/bug tracking, etc.)
? Determine test input data requirements
? Identify tasks, those responsible for tasks, and labor requirements
? Set schedule estimates, timelines, milestones
? Determine input equivalence classes, boundary value analyses, error
classes
? Prepare test plan document and have needed reviews/approvals
? Write test cases
? Have needed reviews/inspections/approvals of test cases
? Prepare test environment and testware, obtain needed user
manuals/reference documents/configuration guides/installation guides,
set up test tracking processes, set up logging and archiving
processes, set up or obtain test input data
? Obtain and install software releases
? Perform tests
? Evaluate and report results
? Track problems/bugs and fixes
? Retest as needed
? Maintain and update test plans, test cases, test environment, and
testware through life cycle
7. What’s a ‘test plan’?

A software project test plan is a document that describes the
objectives, scope, approach, and focus of a software testing effort.
The process of preparing a test plan is a useful way to think through
the efforts needed to validate the acceptability of a software
product. The completed document will help people outside the test
group understand the ‘why’ and ‘how’ of product validation. It should
be thorough enough to be useful but not so thorough that no one
outside the test group will read it. The following are some of the
items that might be included in a test plan, depending on the
particular project:
? Title
? Identification of software including version/release numbers
? Revision history of document including authors, dates, approvals
? Table of Contents
? Purpose of document, intended audience
? Objective of testing effort
? Software product overview
? Relevant related document list, such as requirements, design
documents, other test plans, etc.
? Relevant standards or legal requirements
? Traceability requirements
? Relevant naming conventions and identifier conventions
? Overall software project organization and
personnel/contact-info/responsibilties
? Test organization and personnel/contact-info/responsibilities
? Assumptions and dependencies
? Project risk analysis
? Testing priorities and focus
? Scope and limitations of testing
? Test outline – a decomposition of the test approach by test type,
feature, functionality, process, system, module, etc. as applicable
? Outline of data input equivalence classes, boundary value analysis,
error classes
? Test environment – hardware, operating systems, other required
software, data configurations, interfaces to other systems
? Test environment setup and configuration issues
? Test data setup requirements
? Database setup requirements
? Outline of system-logging/error-logging/other capabilities, and
tools such as screen capture software, that will be used to help
describe and report bugs
? Discussion of any specialized software or hardware tools that will
be used by testers to help track the cause or source of bugs
? Test automation – justification and overview
? Test tools to be used, including versions, patches, etc.
? Test script/test code maintenance processes and version control
? Problem tracking and resolution – tools and processes
? Project test metrics to be used
? Reporting requirements and testing deliverables
? Software entrance and exit criteria
? Initial sanity testing period and criteria
? Test suspension and restart criteria
? Personnel allocation
? Personnel pre-training needs
? Test site/location
? Outside test organizations to be utilized and their purpose,
responsibilties, deliverables, contact persons, and coordination issues
? Relevant proprietary, classified, security, and licensing issues.
? Open issues
? Appendix – glossary, acronyms, etc.
8. What’s a ‘test case’?

? A test case is a document that describes an input, action, or event
and an expected response, to determine if a feature of an application
is working correctly.
? A test case should contain particulars such as test case identifier,
test case name, objective, test conditions/setup, input data
requirements, steps, and expected results.
? Note that the process of developing test cases can help find
problems in the requirements or design of an application, since it
requires completely thinking through the operation of the application.
For this reason, it’s useful to prepare test cases early in the
development cycle if possible.
9. What should be done after a bug is found?

The bug needs to be communicated and assigned to developers who can
fix it.
After the problem is resolved, fixes should be re-tested, and
determinations made regarding requirements for regression testing to
check that fixes didn’t create problems elsewhere. If a
problem-tracking system is in place, it should encapsulate these
processes. A variety of commercial problem-tracking/management
software tools are available . The following are items to be
considered in the tracking process:
? Complete information such that developers can understand the bug,
get an idea of it’s severity, and reproduce it if necessary.
? Bug identifier (number, ID, etc.)
? Current bug status (e.g., ‘Released for Retest’, ‘New’, etc.)
? The application name or identifier and version
? The function, module, feature, object, screen, etc. where the bug
occurred
? Environment specifics, system, platform, relevant hardware specifics
? Test case name/number/identifier
? One-line bug description
? Full bug description
? Description of steps needed to reproduce the bug if not covered by a
test case or if the developer doesn’t have easy access to the test
case/test script/test tool
? Names and/or descriptions of file/data/messages/etc. used in test
? File excerpts/error messages/log file excerpts/screen shots/test
tool logs that would be helpful in finding the cause of the problem
? Severity estimate (a 5-level range such as 1-5 or
‘critical’-to-’low’ is common)
? Was the bug reproducible?
? Tester name
? Test date
? Bug reporting date
? Name of developer/group/organization the problem is assigned to
? Description of problem cause
? Description of fix
? Code section/file/module/class/method that was fixed
? Date of fix
? Application version that contains the fix
? Tester responsible for retest
? Retest date
? Retest results
? Regression testing requirements
? Tester responsible for regression tests
? Regression testing results
A reporting or tracking process should enable notification of
appropriate personnel at various stages.
For instance, testers need to know when retesting is needed,
developers need to know when bugs are found and how to get the needed
information, and reporting/summary capabilities are needed for managers.

10. What is ‘configuration management’?

Configuration management covers the processes used to control,
coordinate, and track: code, requirements, documentation, problems,
change requests, designs, tools/compilers/libraries/patches, changes
made to them, and who makes the changes.

11. What if the software is so buggy it can’t really be tested at all?

The best bet in this situation is for the testers to go through the
process of reporting whatever bugs or blocking-type problems initially
show up, with the focus being on critical bugs. Since this type of
problem can severely affect schedules, and indicates deeper problems
in the software development process (such as insufficient unit
testing or insufficient integration testing, poor design, improper
build or release procedures, etc.) managers should be notified, and
provided with some documentation as evidence of the problem.

12. How can it be known when to stop testing?

This can be difficult to determine. Many modern software applications
are so complex, and run in such an interdependent environment, that
complete testing can never be done. Common factors in deciding when to
stop are:
? Deadlines (release deadlines, testing deadlines, etc.)
? Test cases completed with certain percentage passed
? Test budget depleted
? Coverage of code/functionality/requirements reaches a specified point
? Bug rate falls below a certain level
? Beta or alpha testing period ends
13. What if there isn’t enough time for thorough testing?

Use risk analysis to determine where testing should be focused.

Since it’s rarely possible to test every possible aspect of an
application, every possible combination of events, every dependency,
or everything that could go wrong, risk analysis is appropriate to
most software development projects.
This requires judgement skills, common sense, and experience. (If
warranted, formal methods are also available.)

Considerations can include:

? Which functionality is most important to the project’s intended purpose?
? Which functionality is most visible to the user?
? Which functionality has the largest safety impact?
? Which functionality has the largest financial impact on users?
? Which aspects of the application are most important to the customer?
? Which aspects of the application can be tested early in the
development cycle?
? Which parts of the code are most complex, and thus most subject to
errors?
? Which parts of the application were developed in rush or panic mode?
? Which aspects of similar/related previous projects caused problems?
? Which aspects of similar/related previous projects had large
maintenance expenses?
? Which parts of the requirements and design are unclear or poorly
thought out?
? What do the developers think are the highest-risk aspects of the
application?
? What kinds of problems would cause the worst publicity?
? What kinds of problems would cause the most customer service complaints?
? What kinds of tests could easily cover multiple functionalities?
? Which tests will have the best high-risk-coverage to time-required
ratio?

14. What if the project isn’t big enough to justify extensive testing?

Consider the impact of project errors, not the size of the project.
However, if extensive testing is still not justified, risk analysis is
again needed and the same considerations as described previously in.
The tester might then do ad hoc testing, or write up a limited test
plan based on the risk analysis.

15. What can be done if requirements are changing continuously?

A common problem and a major headache.
? Work with the project’s stakeholders early on to understand how
requirements might change so that alternate test plans and strategies
can be worked out in advance, if possible.
? It’s helpful if the application’s initial design allows for some
adaptability so that later changes do not require redoing the
application from scratch.
? If the code is well-commented and well-documented this makes changes
easier for the developers.
? Use rapid prototyping whenever possible to help customers feel sure
of their requirements and minimize changes.
? The project’s initial schedule should allow for some extra time
commensurate with the possibility of changes.
? Try to move new requirements to a ‘Phase 2′ version of an
application, while using the original requirements for the ‘Phase 1′
version.
? Negotiate to allow only easily-implemented new requirements into the
project, while moving more difficult new requirements into future
versions of the application.
? Be sure that customers and management understand the scheduling
impacts, inherent risks, and costs of significant requirements
changes. Then let management or the customers (not the developers or
testers) decide if the changes are warranted – after all, that’s their
job.
? Balance the effort put into setting up automated testing with the
expected effort required to re-do them to deal with changes.
? Try to design some flexibility into automated test scripts.
? Focus initial automated testing on application aspects that are most
likely to remain unchanged.
? Devote appropriate effort to risk analysis of changes to minimize
regression testing needs.
? Design some flexibility into test cases (this is not easily done;
the best bet might be to minimize the detail in the test cases, or set
up only higher-level generic-type test plans)
? Focus less on detailed test plans and test cases and more on ad hoc
testing (with an understanding of the added risk that this entails).

16. What if the application has functionality that wasn’t in the
requirements?

It may take serious effort to determine if an application has
significant unexpected or hidden functionality, and it would indicate
deeper problems in the software development process.

If the functionality isn’t necessary to the purpose of the
application, it should be removed, as it may have unknown impacts or
dependencies that were not taken into account by the designer or the
customer.
If not removed, design information will be needed to determine added
testing needs or regression testing needs.
Management should be made aware of any significant added risks as a
result of the unexpected functionality.
If the functionality only effects areas such as minor improvements in
the user interface, for example, it may not be a significant risk.

17. How can Software QA processes be implemented without stifling
productivity?

By implementing QA processes slowly over time, using consensus to
reach agreement on processes, and adjusting and experimenting as an
organization grows and matures, productivity will be improved instead
of stifled. Problem prevention will lessen the need for problem
detection, panics and burn-out will decrease, and there will be
improved focus and less wasted effort. At the same time, attempts
should be made to keep processes simple and efficient, minimize
paperwork, promote computer-based processes and automated tracking and
reporting, minimize time required in meetings, and promote training as
part of the QA process. However, no one – especially talented
technical types – likes rules or bureacracy, and in the short run
things may slow down a bit. A typical scenario would be that more days
of planning and development will be needed, but less time will be
required for late-night bug-fixing and calming of irate customers.

18. What if an organization is growing so fast that fixed QA processes
are impossible?

This is a common problem in the software industry, especially in new
technology areas. There is no easy solution in this situation, other than:
? Hire good people
? Management should ‘ruthlessly prioritize’ quality issues and
maintain focus on the customer
? Everyone in the organization should be clear on what ‘quality’ means
to the customer

19. How does a client’server environment affect testing?

Client/server applications can be quite complex due to the multiple
dependencies among clients, data communications, hardware, and servers.
Thus testing requirements can be extensive. When time is limited (as
it usually is) the focus should be on integration and system testing.
Additionally, load/stress/performance testing may be useful in
determining client/server application limitations and capabilities.
There are commercial tools to assist with such testing.

20. How can World Wide Web sites be tested?

Web sites are essentially client/server applications – with web
servers and ‘browser’ clients. Consideration should be given to the
interactions between html pages, TCP/IP communications, Internet
connections, firewalls, applications that run in web pages (such as
applets, javascript, plug-in applications), and applications that run
on the server side (such as cgi scripts, database interfaces, logging
applications, dynamic page generators, asp, etc.).
Additionally, there are a wide variety of servers and browsers,
various versions of each, small but sometimes significant differences
between them, variations in connection speeds, rapidly changing
technologies, and multiple standards and protocols.
The end result is that testing for web sites can become a major
ongoing effort.
Other considerations might include:
? What are the expected loads on the server (e.g., number of hits per
unit time?), and what kind of performance is required under such loads
(such as web server response time, database query response times).
? What kinds of tools will be needed for performance testing (such as
web load testing tools, other tools already in house that can be
adapted, web robot downloading tools, etc.)?
? Who is the target audience? What kind of browsers will they be
using? What kind of connection speeds will they by using? Are they
intra- organization (thus with likely high connection speeds and
similar browsers) or Internet-wide (thus with a wide variety of
connection speeds and browser types)?
? What kind of performance is expected on the client side (e.g., how
fast should pages appear, how fast should animations, applets, etc.
load and run)?
? Will down time for server and content maintenance/upgrades be
allowed? how much?
? What kinds of security (firewalls, encryptions, passwords, etc.)
will be required and what is it expected to do? How can it be tested?
? How reliable are the site’s Internet connections required to be? And
how does that affect backup system or redundant connection
requirements and testing?
? What processes will be required to manage updates to the web site’s
content, and what are the requirements for maintaining, tracking, and
controlling page content, graphics, links, etc.?
? Which HTML specification will be adhered to? How strictly? What
variations will be allowed for targeted browsers?
? Will there be any standards or requirements for page appearance
and/or graphics throughout a site or parts of a site??
? How will internal and external links be validated and updated? how
often?
? Can testing be done on the production system, or will a separate
test system be required? How are browser caching, variations in
browser option settings, dial-up connection variabilities, and
real-world internet ‘traffic congestion’ problems to be accounted for
in testing?
? How extensive or customized are the server logging and reporting
requirements; are they considered an integral part of the system and
do they require testing?
? How are cgi programs, applets, javascripts, ActiveX components, etc.
to be maintained, tracked, controlled, and tested?

? Pages should be 3-5 screens max unless content is tightly focused on
a single topic. If larger, provide internal links within the page.
? The page layouts and design elements should be consistent throughout
a site, so that it’s clear to the user that they’re still within a site.
? Pages should be as browser-independent as possible, or pages should
be provided or generated based on the browser-type.
? All pages should have links external to the page; there should be no
dead-end pages.
? The page owner, revision date, and a link to a contact person or
organization should be included on each page.
21. How is testing affected by object-oriented designs?

Well-engineered object-oriented design can make it easier to trace
from code to internal design to functional design to requirements.
While there will be little affect on black box testing (where an
understanding of the internal design of the application is
unnecessary), white-box testing can be oriented to the application’s
objects. If the application was well-designed this can simplify test
design.

22. What is Extreme Programming and what’s it got to do with testing ?

Extreme Programming (XP) is a software development approach for small
teams on risk-prone projects with unstable requirements.
It was created by Kent Beck who described the approach in his book
‘Extreme Programming Explained’ .
Testing (‘extreme testing’) is a core aspect of Extreme Programming.
Programmers are expected to write unit and functional test code first
- before the application is developed.
Test code is under source control along with the rest of the code.
Customers are expected to be an integral part of the project team and
to help develop scenarios for acceptance/black box testing.
Acceptance tests are preferably automated, and are modified and rerun
for each of the frequent development iterations.

QA and test personnel are also required to be an integral part of the
project team.

Detailed requirements documentation is not used, and frequent
re-scheduling, re-estimating, and re-prioritizing is expected





Commandments For Personal Interviews

10 02 2009

Commandments For Personal Interviews

You have fared well in the written test and the group discussion. You are just a step away from admission to your dream programme — the personal interview. A panel of management experts, a battery of questions. Are you perspiring already? Well, a personal interview could actually be challenging and fun if you just relax and remain focused. Think of it as a conversation between the interview panel and yourself, so enjoy it thoroughly. To begin with, there are four main focus areas in any personal interview:

Personal details

Academic details

Your background

Current affairs

Commandments for every personal interview Even after months of preparation, some candidates do not perform well inside the interview room. The trick is to follow the below commandments practice them during mock interview sessions diligently. You are sure to crack the personal interview.

1. Whenever the interviewer asks any questions, listen carefully. Do not interrupt him midway. Ask for a clarification if the question is not clear. Wait a second or two before you answer. And don’t dive into the answer!

2. Speak clearly. Don’t speak very slowly. Be loud enough so that the interviewers don’t have to strain their ears.

3. Brevity is the hallmark of a good communicator. An over-talkative or verbose person is disliked and misjudged instantly, so keep it short.

4. If you don’t know an answer, be honest. The interviewer will respect your integrity and honesty. Never exaggerate.

5. Never boast about your achievements. Don’t be overconfident — it is often misinterpreted by interviewers for arrogance.

6. Don’t get into an argument with the interviewer on any topic. Restrain yourself, please!

7. Remember your manners. Project an air of humility and be polite.

8. Project enthusiasm. The interviewer usually pays more attention if you display enthusiasm in whatever you say.

9. Maintain a cheerful disposition throughout the interview, because a pleasant countenance holds the interviewers’ interest.

10. Maintain perfect eye contact with all panel members; make sure you address them all. This shows your self-confidence and honesty.





C Sharp Interview Questions

10 02 2009

C Sharp Interview Questions

1) Explain about C#?

Ans:-C # is also known as c sharp. It is a programming language introduced by Microsoft. C# contains features similar to Java and C++. It is specially designed to work with Microsoft .NET platform.

2) Explain about the rules for naming classes in C#?

These are the rules for naming classes in c sharp.
• Must begin with a letter. This letter may be followed by a sequence of letters, digits (0-9), or ‘_’. The first character in a class name cannot be a digit.
• Must not contain any embedded space or symbol like ? – + ! @ # % & . ( ) { } [ ] , : ; ‘ “ and/. However an underscore _ can be used wherever a space is required.
• Must not use a keyword for a class name.

3) What are the rules to be followed while naming variables in C#.

The following rules are used for naming variables in C#.
• Must begin with a letter or an underscore _ which may be followed by a sequence of letters, digits (0-9), or ‘_’. The first character in a variable name cannot be a digit.
•Must not contain any embedded space or symbol like ? – + ! @ # % & . ( ) { } [ ] , : ; ‘ “ and/. However an underscore _ can be used wherever a space is required.
• Must be unique
• Can have any number of characters
• Keywords cannot be used as variable names.

4) What are the different types of Data?

There are two different types of data supported by C#. They are:-

1) Value types: -They directly contain data. When you declare an int variable, the system allocates memory to store the value.
2) Reference type: -The reference types do not maintain data but they contain a reference to the variables, which are stored in memory. This means that if the value in the memory location is modified by one of the variables, the other variables automatically reflect the changes value

5) Explain about member functions?

Ans:-A function is a set of statements that perform a specific task in response to a message. The functions of a class are called member functions in C-sharp. Member functions are declared inside the class. The function declaration introduces the function in the class and the function definition contains the function code.

6) Explain about comment entry?

Ans:-Comments are a part of the program and are used to explain the code. Compilers ignore comment entries. If a comment entry spans more than one line, it has to be enclosed within ‘/.’ and ‘./’. The symbol ‘//’ treats the rest of code within the same line as a comment.

7) What are operators?

Ans:-Applications use operators to process the data entered by a user. Operators like + and – are used to process variables and return a value. An operator is a set of one or more characters that is used for computations or comparisons. Operators can transform one or more data values, called operands into a new data value.
8) Explain about the break statement?

Ans:-A break statement is used to exit the switch statement. This prevents the execution of the remaining case structures by ending the execution of the switch case construct. Each break statement terminates the enclosing switch statement and the flow of control. If none of the cases match the default case is invoked.

9) Define encapsulation?

Ans:-Encapsulation literally means to enclose in or as if in a capsule. Encapsulation is defined as the process of enclosing one or more items within a physical or logical package. It involves preventing access to nonessential details.

10) Define access specifiers with reference to class?

Ans:-An access specifier defines the scope of a class member. A class member refers to the variables and functions in a class. A program can have one or more classes. You may want some members of a class to be accessible to other classes. But, you may not want some other members of the class to be accessible outside the class.

11) Describe about private access specifier?

Ans:-The private access specifier allows a class to hide its member variables and member functions from other class objects and functions. Therefore, the private member of a class is not visible outside a class. If a member is declared private, only the functions of that class can access the member. Even the instance of the class cannot access its members

12) Explain about protected internal access specifier?

Ans:-This specifier allows a class to hide its member variables and member functions to be accessed from other class objects and functions, except the child class, within the application. The protected internal access specifier becomes important while implementing inheritance.

13) Define parameter by value?

Ans:-Pass by value is the default mechanism for passing parameters to a method. The simplest definition of a value parameter is a data type name followed by a variable name. When a method is called, a new storage location is created for each value parameter. The values of the corresponding expressions are copied into them. The expression supplied for each value parameter must be similar to the declaration of the value parameter.

14) State the methods through which parameters can be passed?

Ans:-Parameters can be passed by using any one of the following mechanism.

Value: -They are sometimes called in or out parameters; therefore, the data can be transferred into the method but cannot be transferred out.
Reference: -Are sometimes called in or out parameters, therefore, the data can be transferred into the method and out again.
Output: -Are sometimes called out parameters, data can be transferred out of the method.

15) Explain about reference parameter?

Ans:-A reference parameter is a reference to a memory location of a data member. Unlike a value parameter, a reference parameter does not create a new storage location. Instead a reference parameter represents the same location in memory as the variable that is supplied in the method call.

16) How do you use a structure?

Ans:-A structure is a value type data type. When you want a single variable to hold related data of various data types, you can create a structure. To create a structure you use the struct keyword.

17) What is an enumerator?

Ans:-Enumeration is a value data type, which means that enumeration contains its own values and cannot inherit or pass inheritance. Enumerator allows you to assign symbolic names or integral constants.





Java 5 SCJP Questions

10 02 2009

Interview Questions : Java 5 SCJP Questions

1. Given:
enum Horse {
PONY(10),
// insert code here
HORSE(15);

Horse(int hands) {
this.height = hands;
this.weight = hands * 100;
}
int height;
int weight;
int getWeight() { return weight; }
void setWeight(int w) { weight = w; }
}

class Stable {
public static void main(String [] hay) {
Horse h = Horse.ICELANDIC;
System.out.println(h.getWeight() + ” ” + h.height);
}
}

Which, inserted independently at ‘// insert code here’, produces the output:
800 13 ? (Choose all that apply.)

A). ICELANDIC(13) { weight = 800; },
B). ICELANDIC(13) { setWeight(800); },
C). ICELANDIC(13) { this.weight = 800; },
D). ICELANDIC(13) { public int getWeight() { return 800; } },
E). None of the above code will produce the specified output.
F). Because of other code errors, none of the above will compile.

2. Given:
1. class Voop {
2. public static void main(String [] args) {
3. doStuff(1);
4. doStuff(1,2);
5. }
6. // insert code here
7. }

Which, inserted at line 6, will compile? (Choose all that apply.)

A). static void doStuff(int… doArgs) { }
B). static void doStuff(int[] doArgs) { }
C). static void doStuff(int doArgs…) { }
D). static void doStuff(int… doArgs, int y) { }
E). static void doStuff(int x, int… doArgs) { }
F). None of the above code fragments will compile.

3. Given:
class Bird {
{ System.out.print(“b1 “); }
public Bird() { System.out.print(“b2 “); }
}
class Raptor extends Bird {
static { System.out.print(“r1 “); }
public Raptor() { System.out.print(“r2 “); }
{ System.out.print(“r3 “); }
static { System.out.print(“r4 “); }
}
class Hawk extends Raptor {
public static void main(String[] args) {
System.out.print(“pre “);
new Hawk();
System.out.println(“hawk “);
}
}

What is the result?

A). pre b1 b2 r3 r2 hawk
B). pre b2 b1 r2 r3 hawk
C). pre b2 b1 r2 r3 hawk r1 r4
D). r1 r4 pre b1 b2 r3 r2 hawk
E). r1 r4 pre b2 b1 r2 r3 hawk
F). pre r1 r4 b1 b2 r3 r2 hawk
G). pre r1 r4 b2 b1 r2 r3 hawk
H). The order of output cannot be predicted
I). Compilation fails

4. Which are most typically thrown by an API developer or an application developer as opposed to being thrown by the JVM? (Choose all that apply.)
A). ClassCastException
B). IllegalStateException
C). NumberFormatException
D). IllegalArgumentException
E). ExceptionInInitializerError

5. Given:
class Eggs {
int doX(Long x, Long y) { return 1; }
int doX(long… x) { return 2; }
int doX(Integer x, Integer y) { return 3; }
int doX(Number n, Number m) { return 4; }

public static void main(String[] args) {
new Eggs().go();
}
void go() {
short s = 7;
System.out.print(doX(s,s) + ” “);
System.out.println(doX(7,7));
}
}

What is the result?

A). 1 1
B). 2 1
C). 3 1
D). 4 1
E). 1 3
F). 2 3
G). 3 3
H). 4 3

6. Given:
import java.io.*;
class Player {
Player() { System.out.print(“p”); }
}
class CardPlayer extends Player implements Serializable {
CardPlayer() { System.out.print(“c”); }
public static void main(String[] args) {
CardPlayer c1 = new CardPlayer();
try {
FileOutputStream fos = new FileOutputStream(“play.txt”);
ObjectOutputStream os = new ObjectOutputStream(fos);
os.writeObject(c1);
os.close();
FileInputStream fis = new FileInputStream(“play.txt”);
ObjectInputStream is = new ObjectInputStream(fis);
CardPlayer c2 = (CardPlayer) is.readObject();
is.close();
} catch (Exception x ) { }
}
}

What is the result?

A). pc
B). pcc
C). pcp
D). pcpc
E). Compilation fails
F). An exception is thrown at runtime

7. Given:

import java.util.regex.*;
class Regex2 {
public static void main(String[] args) {
Pattern p = Pattern.compile(args[0]);
Matcher m = p.matcher(args[1]);
boolean b = false;
while(b = m.find()) {
System.out.print(m.start() + m.group());
}
}
}

And the command line:

java Regex2 “d*” ab34ef

What is the result?

A). 234
B). 334
C). 2334
D). 0123456
E). 01234456
F). 12334567
G). Compilation fails

8. Given:
bw is a reference to a valid BufferedWriter

And the snippet:

15 BufferedWriter b1 = new BufferedWriter(new File(“f”));
16. BufferedWriter b2 = new BufferedWriter(new FileWriter(“f1″));
17. BufferedWriter b3 = new BufferedWriter(new PrintWriter(“f2″));
18. BufferedWriter b4 = new BufferedWriter(new BufferedWriter(bw));

What is the result?

A). Compilation succeeds
B). Compilation fails due only to an error on line 15.
C). Compilation fails due only to an error on line 16.
D). Compilation fails due only to an error on line 17.
E). Compilation fails due only to an error on line 18.
F). Compilation fails due to errors on multiple lines.

9. Using the fragments below, complete the following code so that it compiles and prints “40 36 30 28″. Note, you may use a fragment from zero to many times.

CODE:

import java.util.*;
class Pants { int size; Pants(int s) { size = s; } }
public class FoldPants {
List ________ p = new ArrayList ________ ();
class Comp implements Comparator ________ {
public int ________(Pants one, Pants two) {
return ________ – ________;
}
}
public static void main(String[] args) {
new FoldPants().go();
}
void go() {
p.add(new Pants(30));
p.add(new Pants(36));
p.add(new Pants(28));
p.add(new Pants(40));

Comp c = new Comp();
Collections. ________ ________;
for( ________ x : p)
System.out.print(________ + ” “);
}
}

FRAGMENTS:

Pants FoldPants Comp Comparator
compare compareTo sort order
one.size two.size x.size p.size
c.size (p, c) (c, p) sortList

10. Given the following three source files:
1. package org;
2. public class Robot { }

1. package org.ex;
2. public class Pet { }

1. package org.ex.why;
2. public class Dog { int foo = 5; }

And the following incomplete source file:

// insert code here
public class MyClass {
Robot r;
Pet p;
Dog d;
void go() {
int x = d.foo;
}
}

Which statement(s) must be added for MyClass to compile? (Choose all that apply.)

A). package org;
B). import org.*;
C). package org.*;
D). package org.ex;
E). import org.ex.*;
F). import org.ex.why;
G). package org.ex.why;
H). package org.ex.why.Dog;

11. Given:
1. import java.util.*;
2. public class Fruits {
3. public static void main(String [] args) {
4. Set c1 = new TreeSet();
5. Set o1 = new TreeSet();
6. bite(c1);
7. bite(o1);
8. }
9. // insert code here
10. }
11. class Citrus { }
12. class Orange extends Citrus { }

Which, inserted independently at line 9, will compile? (Choose all that apply.)

A). public static void bite(Set s) { }
B). public static void bite(Set s) { }
C). public static void bite(Set s) { }
D). public static void bite(Set s) { }
E). public static void bite(Set s) { }
F). public static void bite(Set s) { }
G). Because of other errors in the code, none of these will compile.

Answers:

1. D is correct. (objective 1.1)

2. A and E use valid var-args syntax. (objective 1.1)
3. D is correct. Note: you’ll probably never see this many choices on the real exam! (objective 1.3)
4. B, C and D are correct. (objective 2.6)
5. H is correct. (objective 3.1)
6. C is correct. (objective 3.3)
7. E is correct. (objective 3.5)
8. B is correct. (objective 3.2)
9. The correct code is:

import java.util.*;
class Pants { int size; Pants(int s) { size = s; } }
public class FoldPants {
List p = new ArrayList();
class Comp implements Comparator {
public int compare(Pants one, Pants two) {
return two.size – one.size;
}
}
public static void main(String[] args) {
new FoldPants().go();
}
void go() {
p.add(new Pants(30));
p.add(new Pants(36));
p.add(new Pants(28));
p.add(new Pants(40));

Comp c = new Comp();
Collections.sort(p, c);
for(Pants x : p)
System.out.print(x.size + ” “);
}
}

(objective 6.5)

10. B, E, and G are required. (objective 7.5)
11. A, E, and F are correct uses of generics with (bounded) wildcards. (objective 6.4)