Tuesday, June 30, 2009
TOP 5 H-R Questions
ANS-->TRAPS: Beware, about 80% of all interviews begin with this “innocent” question. Many candidates, unprepared for the question, skewer themselves by rambling, recapping their life story, delving into ancient work history or personal matters.
BEST ANSWER: 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:
1. Do all the homework you can before the interview to uncover this person's wants and needs (not the generalized needs of the industry or company)
2. 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.
Q-->What are your greatest strengths?
TRAPS: This question seems like a softball lob, but be prepared. You don't want to come across as egotistical or arrogant. Neither is this a time to be humble.
BEST ANSWER: 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:
1. A proven track record as an achiever...especially if your achievements match up with the employer's greatest wants and needs.
2. Intelligence...management "savvy".
3. Honesty...integrity...a decent human being.
4. Good fit with corporate culture...someone to feel comfortable with...a team player who meshes well with interviewer's team.
5. Likeability...positive attitude...sense of humor.
6. Good communication skills.
7. Dedication...willingness to walk the extra mile to achieve excellence.
8. Definiteness of purpose...clear goals.
9. Enthusiasm...high level of motivation.
10. Confident...healthy...a leader.
Q-->Why should I hire you?
ANS-->
TRAPS: Believe it or not, this is a killer question because so many candidates are unprepared for it. If you stammer or adlib you’ve blown it.
BEST ANSWER: By now you can see how critical it is to apply the overall strategy of uncovering the employer’s needs before you answer questions. If you know the employer’s greatest needs and desires, this question will give you a big leg up over other candidates because you will give him better reasons for hiring you than anyone else is likely to…reasons tied directly to his needs.
Whether your interviewer asks you this question explicitly or not, this is the most important question of your interview because he must answer this question favorably in is own mind before you will be hired. So help him out! Walk through each of the position’s requirements as you understand them, and follow each with a reason why you meet that requirement so well.
Example: “As I understand your needs, you are first and foremost looking for someone who can manage the sales and marketing of your book publishing division. As you’ve said you need someone with a strong background in trade book sales. This is where I’ve spent almost all of my career, so I’ve chalked up 18 years of experience exactly in this area. I believe that I know the right contacts, methods, principles, and successful management techniques as well as any person can in our industry.”
“You also need someone who can expand your book distribution channels. In my prior post, my innovative promotional ideas doubled, then tripled, the number of outlets selling our books. I’m confident I can do the same for you.”
“You need someone to give a new shot in the arm to your mail order sales, someone who knows how to sell in space and direct mail media. Here, too, I believe I have exactly the experience you need. In the last five years, I’ve increased our mail order book sales from $600,000 to $2,800,000, and now we’re the country’s second leading marketer of scientific and medical books by mail.” Etc., etc., etc.,
Every one of these selling “couplets” (his need matched by your qualifications) is a touchdown that runs up your score. IT is your best opportunity to outsell your competition.
Q-->Where do you see yourself five years from now?
ANS-->TRAPS: One reason interviewers ask this question is to see if you’re settling for this position, using it merely as a stopover until something better comes along. Or they could be trying to gauge your level of ambition.
If you’re too specific, i.e., naming the promotions you someday hope to win, you’ll sound presumptuous. If you’re too vague, you’ll seem rudderless.
BEST ANSWER: Reassure your interviewer that you’re looking to make a long-term commitment…that this position entails exactly what you’re looking to do and what you do extremely well. As for your future, you believe that if you perform each job at hand with excellence, future opportunities will take care of themselves.
Example: “I am definitely interested in making a long-term commitment to my next position. Judging by what you’ve told me about this position, it’s exactly what I’m looking for and what I am very well qualified to do. In terms of my future career path, I’m confident that if I do my work with excellence, opportunities will inevitable open up for me. It’s always been that way in my career, and I’m confident I’ll have similar opportunities here.”
Q-->What are your greatest weaknesses?
TRAPS: Beware - this is an eliminator question, designed to shorten the candidate list. Any admission of a weakness or fault will earn you an “A” for honesty, but an “F” for the interview.
PASSABLE ANSWER: 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.)
ANS-->
Hindi Shayari(Poem)
Dobara Aaj Khuda Se Gila Kar Ke Roye Hain
Kyon Na Likh Saka Tu Us Ko Taqdeer Mein Meri
Yeh Aik Khayal Soch Kar Phir Hum Roye Hain.
Sapne Ki Tarah Aakar Chale Gaye
Gamo Ki Neend Sulakar Chale Gaye
Kis Bhool Ki Saza Di Humko??
Pehle Hasaya Aur Fir Rulakar Chale Gaye. Hum ko to muskranay ki Aadat si hai
Ansoon ko Chupanay ki Aadat si hai
Duwa na hi Dawa Kaam kerti Hai hum per..
Ab to Zakhm Khanay ki Aadat si Hai..
Paane se khone ka maza aur hai
Bandh aankhon main rone ka maza aur hai
Aansoo bane lafz aur lafz bane ghazal
aur uss ghazal main tere hone ka maza aur hai
Monday, June 8, 2009
Kanha National Park (Wildlife Sanctuary)Jabalpur
'''Kanha National Park'''
It is a [[National park of India|national park]] and a Tiger Reserve in the [[Mandla]] and [[Balaghat]] districts of [[Madhya Pradesh]], [[India]]. In the 1930s, Kanha area was divided into two sanctuaries, Hallon and Banjar, of 250 and 300 km² each. Kanha National Park was created on [[1 June]] [[1955]]. Today it stretches over an area of 940 km² in the two districts [[Mandla]] and [[Balaghat]]. Together with a surrounding buffer zone of 1009 km² and the neighboring 110 km² Phen Sanctuary it forms the Kanha Tiger Reserve. The park has a significant population of [[Royal Bengal Tiger]], [[leopard]]s, the [[sloth bear]], [[Barasingha]] and [[Dhole|Indian wild dog]].
Flora ==
The lowland forest is a mixture of [[sal]] (''shorea robusta'') and other mixed forest trees, interspersed with meadows. The highland forests are tropical moist dry deciduous type and of a completely different nature with bamboo on slopes (''dendrocalamus strictus''). A very good looking Indian ghost tree (kullu) can also be seen in the dense.
Kanha Tiger Reserve abounds in meadows or ''maidans'' which are basically open grasslands that have sprung up in fields of abundant villages, evacuated to make way for the animals. Kanha meadow is one such example. There are many species of grass recorded at Kanha some of which are important for the survival of [[Barasingha]] (''Cervus duvauceli branderi''). Dense forested zones with good crown cover has abundant species of climbers, shrubs and herbs flourishing in the understory. Aquatic plants in numerous "tal" (lakes) are life line for migratory and wetland species of birds.
== Transportation & facility==
Jabalpur has the nearest Aerodrome (169 K.M.) which is connected with Delhi, Mumbai, and bhopal. Mandla (70 K.M.) is well connected with Kanha,
[[Mandla]] has sports clubs, Internet cafes, guides, churches (Catholic + Protestant) and hundreds of beautiful temples around the city.
There are three gates for entrance into the forest. The Kisli gate is best accessible from Jabalpur. The Kisli gate stops at village Khatia which comes inside the buffer area. The second gate is Mukki. The third and recently opened gate is Serai gate.
=== General information ===
* Area: (core) 940 km²
* Terrain: sal and bamboo forests, plateaus, meadows and meandering streams
* Best Season: February to June
* Morning Visiting Hours: 630Hrs to 1200Hrs
* Evening Visiting Hours: 1500Hrs to 1800Hrs
* Closed: [[1 July]] to [[30 September]]
The nearest airport and railhead is at [[Jabalpur]and [Nagpur]] (160 km, 3 hours by road from Jabalpur and 260 km, 6 hrs from Nagpur).
== General References ==
* K. K. Gurung & Raj Singh: ''Field Guide to the Mammals of the Indian Subcontinent'', Academic Press, San Diego, ISBN 0-12-309350-3
* A. P. Dwivendi: ''Protected Areas of Madhya Pradesh'',Government printing Press, Bhopal 2003
== External links ==
=== Photos ===
* [http://travel.webshots.com/album/557880001efIMUh Kanha National Park Photo Gallery]
* [http://www.flickr.com/photos/sachinrai/sets/72157594478736117/ Kanha National Park Photos on Flickr]
http://picasaweb.google.com/purvimistry/KanhaNPMAY2008?feat=directlink
=== Info on Kanha National Park ===
* [http://www.webhush.com/kanha-national-park-madhya-pradesh/ Kanha National Park - Madhya Pradesh]
* [http://www.wildlifetimes.com/forums/viewtopic.php?t=246 Wildlife Times: The Central Indian Tiger Pilgrimage - A trip report]
* [http://www.kanha-national-park.com Kanha National Park]
* [http://www.pgoimages.com/g_india_kanha.php Images from Kanha National Park]
* [http://www.unep-wcmc.org/igcmc/s_sheets/madhaya_/0115v.html UNEP World Conservation Monitoring Centre]{{dead link|date=January 2008|url=http://www.unep-wcmc.org/igcmc/s_sheets/madhaya_/0115v.html}}
* [http://www.mptourism.com/dest/kanha.html Madhya Pradesh State Tourism]
* [http://www.indiatouristspots.com/wildlife/kanha-national-park.html Kanha National Park]
* [http://www.dharssi.org.uk/travel/india/kanha_wildlife_park.html Photos and travel tips for Kanha national park]
* [http://www.ankurverma.ws/thumbnails.php?album=3 Travel Gallery from 2003 Trip]
* [http://www.geocities.com/pateluday/kanha.htm Kanha Tiger Reserve]
* {{wikitravel}}
{{National Parks of India}}
[[Category:National parks in Madhya Pradesh]]
[[Category:Balaghat]]
[[Category:Mandla]]
[[de:Kanha-Nationalpark]]
[[hi:कान्हा राष्ट्रीय उद्यान]]
[[fr:Parc national de Kanha]]
[[it:Parco nazionale di Kanha]]
[[mr:कान्हा राष्ट्रीय उद्यान]]
official website::
http://www.kanha-national-park.com
Wednesday, March 18, 2009
java twister
Ans: Yes,we can run our java program without using the main function see below:
class sachin
{
static
{
System.out.println("hello! how are you");
System.exit();
}
}
-->so ,by using the above code we can easily run our java program without main function.
Logic-->Actually,static block always executes bafore the main function since JVM firstly executes the static block and before the control goes to the main function we can make it exit by using System.exit() so in this way their is only one way to execute the java program without main ,another way is by using applet.
Sunday, January 18, 2009
DBMS & RDBMS interview questions
RDBMS Concepts
1. What is database?
2. What is DBMS?
It is a collection of programs that enables user to create and maintain a database. In other words it is general-purpose software that provides the users with the processes of defining, constructing and manipulating the database for various applications.
3. What is a Database system?
The database and DBMS software together is called as Database system.
4. Advantages of DBMS?
Redundancy is controlled.
Unauthorised access is restricted.
Providing multiple user interfaces.
Enforcing integrity constraints.
Providing backup and recovery.
5. Disadvantage in File Processing System?
Data redundancy & inconsistency.
Difficult in accessing data.
Data isolation.
Data integrity.
Concurrent access is not possible.
Security Problems.
6. Describe the three levels of data abstraction?
The are three levels of abstraction:
Physical level: The lowest level of abstraction describes how data are stored.
Logical level: The next higher level of abstraction, describes what data are stored in database and what relationship among those data.
View level: The highest level of abstraction describes only part of entire database.
There are two Integrity rules.
Entity Integrity: States that “Primary key cannot have NULL value”
Referential Integrity: States that “Foreign Key can be either a NULL value or should be Primary Key value of other relation.
8. What is extension and intension?
Extension -
It is the number of tuples present in a table at any instance. This is time dependent.
Intension -
It is a constant value that gives the name, structure of table and the constraints laid on it.
9. What is System R? What are its two major subsystems?
System R was designed and developed over a period of 1974-79 at IBM San Jose Research Center. It is a prototype and its purpose was to demonstrate that it is possible to build a Relational System that can be used in a real life environment to solve real life problems, with performance at least comparable to that of existing system.
Its two subsystems are
Research Storage
System Relational Data System.
10. How is the data structure of System R different from the relational structure?
Unlike Relational systems in System R
Domains are not supported
Enforcement of candidate key uniqueness is optional
Enforcement of entity integrity is optional
Referential integrity is not enforced
11. What is Data Independence?
Data independence means that “the application is independent of the storage structure and access strategy of data”. In other words, The ability to modify the schema definition in one level should not affect the schema definition in the next higher level.
Two types of Data Independence:
Physical Data Independence: Modification in physical level should not affect the logical level.
Logical Data Independence: Modification in logical level should affect the view level.
NOTE: Logical Data Independence is more difficult to achieve
12. What is a view? How it is related to data independence?
A view may be thought of as a virtual table, that is, a table that does not really exist in its own right but is instead derived from one or more underlying base table. In other words, there is no stored file that direct represents the view instead a definition of view is stored in data dictionary.
Growth and restructuring of base tables is not reflected in views. Thus the view can insulate users from the effects of restructuring and growth in the database. Hence accounts for logical data independence.
13. What is Data Model?
A collection of conceptual tools for describing data, data relationships data semantics and constraints.
14. What is E-R model?
This data model is based on real world that consists of basic objects called entities and of relationship among these objects. Entities are described in a database by a set of attributes.
15. What is Object Oriented model?
This model is based on collection of objects. An object contains values stored in instance variables with in the object. An object also contains bodies of code that operate on the object. These bodies of code are called methods. Objects that contain same types of values and the same methods are grouped together into classes.
16. What is an Entity?
It is a 'thing' in the real world with an independent existence.
17. What is an Entity type?
It is a collection (set) of entities that have same attributes.
18. What is an Entity set?
It is a collection of all entities of particular entity type in the database.
19. What is an Extension of entity type?
The collections of entities of a particular entity type are grouped together into an entity set.
20. What is Weak Entity set?
An entity set may not have sufficient attributes to form a primary key, and its primary key compromises of its partial key and primary key of its parent entity, then it is said to be Weak Entity set.
21. What is an attribute?
It is a particular property, which describes the entity.
22. What is a Relation Schema and a Relation?
A relation Schema denoted by R(A1, A2, …, An) is made up of the relation name R and the list of attributes Ai that it contains. A relation is defined as a set of tuples. Let r be the relation which contains set tuples (t1, t2, t3, ..., tn). Each tuple is an ordered list of n-values t=(v1,v2, ..., vn).
23. What is degree of a Relation?
It is the number of attribute of its relation schema.
24. What is Relationship?
It is an association among two or more entities.
25. What is Relationship set?
The collection (or set) of similar relationships.
26. What is Relationship type?
Relationship type defines a set of associations or a relationship set among a given set of entity types.
27. What is degree of Relationship type?
It is the number of entity type participating.
25. What is DDL (Data Definition Language)?
A data base schema is specifies by a set of definitions expressed by a special language called DDL.
26. What is VDL (View Definition Language)?
It specifies user views and their mappings to the conceptual schema.
27. What is SDL (Storage Definition Language)?
This language is to specify the internal schema. This language may specify the mapping between two schemas.
28. What is Data Storage - Definition Language?
The storage structures and access methods used by database system are specified by a set of definition in a special type of DDL called data storage-definition language.
29. What is DML (Data Manipulation Language)?
This language that enable user to access or manipulate data as organised by appropriate data model.
Procedural DML or Low level: DML requires a user to specify what data are needed and how to get those data.
Non-Procedural DML or High level: DML requires a user to specify what data are needed without specifying how to get those data.
31. What is DML Compiler?
It translates DML statements in a query language into low-level instruction that the query evaluation engine can understand.
32. What is Query evaluation engine?
It executes low-level instruction generated by compiler.
33. What is DDL Interpreter?
It interprets DDL statements and record them in tables containing metadata.
34. What is Record-at-a-time?
The Low level or Procedural DML can specify and retrieve each record from a set of records. This retrieve of a record is said to be Record-at-a-time.
35. What is Set-at-a-time or Set-oriented?
The High level or Non-procedural DML can specify and retrieve many records in a single DML statement. This retrieve of a record is said to be Set-at-a-time or Set-oriented.
36. What is Relational Algebra?
It is procedural query language. It consists of a set of operations that take one or two relations as input and produce a new relation.
37. What is Relational Calculus?
It is an applied predicate calculus specifically tailored for relational databases proposed by E.F. Codd. E.g. of languages based on it are DSL ALPHA, QUEL.
38. How does Tuple-oriented relational calculus differ from domain-oriented relational calculus
The tuple-oriented calculus uses a tuple variables i.e., variable whose only permitted values are tuples of that relation. E.g. QUEL
The domain-oriented calculus has domain variables i.e., variables that range over the underlying domains instead of over relation. E.g. ILL, DEDUCE.
39. What is normalization?
It is a process of analysing the given relation schemas based on their Functional Dependencies (FDs) and primary key to achieve the properties
Minimizing redundancy
Minimizing insertion, deletion and update anomalies.
40. What is Functional Dependency?
A Functional dependency is denoted by X Y between two sets of attributes X and Y that are subsets of R specifies a constraint on the possible tuple that can form a relation state r of R. The constraint is for any two tuples t1 and t2 in r if t1[X] = t2[X] then they have t1[Y] = t2[Y]. This means the value of X component of a tuple uniquely determines the value of component Y.
41. When is a functional dependency F said to be minimal?
Every dependency in F has a single attribute for its right hand side.
We cannot replace any dependency X A in F with a dependency Y A where Y is a proper subset of X and still have a set of dependency that is equivalent to F.
We cannot remove any dependency from F and still have set of dependency that is equivalent to F.
42. What is Multivalued dependency?
Multivalued dependency denoted by X Y specified on relation schema R, where X and Y are both subsets of R, specifies the following constraint on any relation r of R: if two tuples t1 and t2 exist in r such that t1[X] = t2[X] then t3 and t4 should also exist in r with the following properties
t3[x] = t4[X] = t1[X] = t2[X]
t3[Y] = t1[Y] and t4[Y] = t2[Y]
t3[Z] = t2[Z] and t4[Z] = t1[Z]
where [Z = (R-(X U Y)) ]
43. What is Lossless join property?
It guarantees that the spurious tuple generation does not occur with respect to relation schemas after decomposition.
44. What is 1 NF (Normal Form)?
The domain of attribute must include only atomic (simple, indivisible) values.
45. What is Fully Functional dependency?
It is based on concept of full functional dependency. A functional dependency X Y is full functional dependency if removal of any attribute A from X means that the dependency does not hold any more.
46. What is 2NF?
A relation schema R is in 2NF if it is in 1NF and every non-prime attribute A in R is fully functionally dependent on primary key.
47. What is 3NF?
A relation schema R is in 3NF if it is in 2NF and for every FD X A either of the following is true
X is a Super-key of R.
A is a prime attribute of R.
In other words, if every non prime attribute is non-transitively dependent on primary key.
48. What is BCNF (Boyce-Codd Normal Form)?
A relation schema R is in BCNF if it is in 3NF and satisfies an additional constraint that for every FD X A, X must be a candidate key.
49. What is 4NF?
A relation schema R is said to be in 4NF if for every Multivalued dependency X Y that holds over R, one of following is true
X is subset or equal to (or) XY = R.
X is a super key.
50. What is 5NF?
A Relation schema R is said to be 5NF if for every join dependency {R1, R2, ..., Rn} that holds R, one the following is true
Ri = R for some i.
The join dependency is implied by the set of FD, over R in which the left side is key of R.
51. What is Domain-Key Normal Form?
A relation is said to be in DKNF if all constraints and dependencies that should hold on the the constraint can be enforced by simply enforcing the domain constraint and key constraint on the relation.
52. What are partial, alternate,, artificial, compound and natural key?
Partial Key:
It is a set of attributes that can uniquely identify weak entities and that are related to same owner entity. It is sometime called as Discriminator.
Alternate Key:
All Candidate Keys excluding the Primary Key are known as Alternate Keys.
Artificial Key:
If no obvious key, either stand alone or compound is available, then the last resort is to simply create a key, by assigning a unique number to each record or occurrence. Then this is known as developing an artificial key.
Compound Key:
If no single data element uniquely identifies occurrences within a construct, then combining multiple elements to create a unique identifier for the construct is known as creating a compound key.
Natural Key:
When one of the data elements stored within a construct is utilized as the primary key, then it is called the natural key.
53. What is indexing and what are the different kinds of indexing?
Indexing is a technique for determining how quickly specific data can be found.
Types:
Binary search style indexing
B-Tree indexing
Inverted list indexing
Memory resident table
Table indexing
54. What is system catalog or catalog relation? How is better known as?
A RDBMS maintains a description of all the data that it contains, information about every relation and index that it contains. This information is stored in a collection of relations maintained by the system called metadata. It is also called data dictionary.
55. What is meant by query optimization?
The phase that identifies an efficient execution plan for evaluating a query that has the least estimated cost is referred to as query optimization.
56. What is join dependency and inclusion dependency?
Join Dependency:
A Join dependency is generalization of Multivalued dependency.A JD {R1, R2, ..., Rn} is said to hold over a relation R if R1, R2, R3, ..., Rn is a lossless-join decomposition of R . There is no set of sound and complete inference rules for JD.
Inclusion Dependency:
An Inclusion Dependency is a statement of the form that some columns of a relation are contained in other columns. A foreign key constraint is an example of inclusion dependency.
57. What is durability in DBMS?
Once the DBMS informs the user that a transaction has successfully completed, its effects should persist even if the system crashes before all its changes are reflected on disk. This property is called durability.
58. What do you mean by atomicity and aggregation?
Atomicity:
Either all actions are carried out or none are. Users should not have to worry about the effect of incomplete transactions. DBMS ensures this by undoing the actions of incomplete transactions.
Aggregation:
A concept which is used to model a relationship between a collection of entities and relationships. It is used when we need to express a relationship among relationships.
59. What is a Phantom Deadlock?
In distributed deadlock detection, the delay in propagating local information might cause the deadlock detection algorithms to identify deadlocks that do not really exist. Such situations are called phantom deadlocks and they lead to unnecessary aborts.
60. What is a checkpoint and When does it occur?
A Checkpoint is like a snapshot of the DBMS state. By taking checkpoints, the DBMS can reduce the amount of work to be done during restart in the event of subsequent crashes.
61. What are the different phases of transaction?
Different phases are
Analysis phase
Redo Phase
Undo phase
62. What do you mean by flat file database?
It is a database in which there are no programs or user access languages. It has no cross-file capabilities but is user-friendly and provides user-interface management.
63. What is "transparent DBMS"?
It is one, which keeps its Physical Structure hidden from user.
64. Brief theory of Network, Hierarchical schemas and their properties
Network schema uses a graph data structure to organize records example for such a database management system is CTCG while a hierarchical schema uses a tree data structure example for such a system is IMS.
65. What is a query?
A query with respect to DBMS relates to user commands that are used to interact with a data base. The query language can be classified into data definition language and data manipulation language.
66. What do you mean by Correlated subquery?
Subqueries, or nested queries, are used to bring back a set of rows to be used by the parent query. Depending on how the subquery is written, it can be executed once for the parent query or it can be executed once for each row returned by the parent query. If the subquery is executed for each row of the parent, this is called a correlated subquery.
A correlated subquery can be easily identified if it contains any references to the parent subquery columns in its WHERE clause. Columns from the subquery cannot be referenced anywhere else in the parent query. The following example demonstrates a non-correlated subquery.
E.g. Select * From CUST Where '10/03/1990' IN (Select ODATE From ORDER Where CUST.CNUM = ORDER.CNUM)
67. What are the primitive operations common to all record management systems?
Addition, deletion and modification.
68. Name the buffer in which all the commands that are typed in are stored
‘Edit’ Buffer
69. What are the unary operations in Relational Algebra?
PROJECTION and SELECTION.
70. Are the resulting relations of PRODUCT and JOIN operation the same?
No.
PRODUCT: Concatenation of every row in one relation with every row in another.
JOIN: Concatenation of rows from one relation and related rows from another.
71. What is RDBMS KERNEL?
Two important pieces of RDBMS architecture are the kernel, which is the software, and the data dictionary, which consists of the system-level data structures used by the kernel to manage the database
You might think of an RDBMS as an operating system (or set of subsystems), designed specifically for controlling data access; its primary functions are storing, retrieving, and securing data. An RDBMS maintains its own list of authorized users and their associated privileges; manages memory caches and paging; controls locking for concurrent resource usage; dispatches and schedules user requests; and manages space usage within its table-space structures
.
72. Name the sub-systems of a RDBMS
I/O, Security, Language Processing, Process Control, Storage Management, Logging and Recovery, Distribution Control, Transaction Control, Memory Management, Lock Management
73. Which part of the RDBMS takes care of the data dictionary? How
Data dictionary is a set of tables and database objects that is stored in a special area of the database and maintained exclusively by the kernel.
74. What is the job of the information stored in data-dictionary?
The information in the data dictionary validates the existence of the objects, provides access to them, and maps the actual physical storage location.
75. Not only RDBMS takes care of locating data it also
determines an optimal access path to store or retrieve the data
76. How do you communicate with an RDBMS?
You communicate with an RDBMS using Structured Query Language (SQL)
77. Define SQL and state the differences between SQL and other conventional programming Languages
SQL is a nonprocedural language that is designed specifically for data access operations on normalized relational database structures. The primary difference between SQL and other conventional programming languages is that SQL statements specify what data operations should be performed rather than how to perform them.
78. Name the three major set of files on disk that compose a database in Oracle
There are three major sets of files on disk that compose a database. All the files are binary. These are
Database files
Control files
Redo logs
The most important of these are the database files where the actual data resides. The control files and the redo logs support the functioning of the architecture itself.
All three sets of files must be present, open, and available to Oracle for any data on the database to be useable. Without these files, you cannot access the database, and the database administrator might have to recover some or all of the database using a backup, if there is one.
79. What is an Oracle Instance?
The Oracle system processes, also known as Oracle background processes, provide functions for the user processes—functions that would otherwise be done by the user processes themselves
Oracle database-wide system memory is known as the SGA, the system global area or shared global area. The data and control structures in the SGA are shareable, and all the Oracle background processes and user processes can use them.
The combination of the SGA and the Oracle background processes is known as an Oracle instance
80. What are the four Oracle system processes that must always be up and running for the database to be useable
The four Oracle system processes that must always be up and running for the database to be useable include DBWR (Database Writer), LGWR (Log Writer), SMON (System Monitor), and PMON (Process Monitor).
81. What are database files, control files and log files. How many of these files should a database have at least? Why?
Database Files
The database files hold the actual data and are typically the largest in size. Depending on their sizes, the tables (and other objects) for all the user accounts can go in one database file—but that's not an ideal situation because it does not make the database structure very flexible for controlling access to storage for different users, putting the database on different disk drives, or backing up and restoring just part of the database.
You must have at least one database file but usually, more than one files are used. In terms of accessing and using the data in the tables and other objects, the number (or location) of the files is immaterial.
The database files are fixed in size and never grow bigger than the size at which they were created
Control Files
The control files and redo logs support the rest of the architecture. Any database must have at least one control file, although you typically have more than one to guard against loss. The control file records the name of the database, the date and time it was created, the location of the database and redo logs, and the synchronization information to ensure that all three sets of files are always in step. Every time you add a new database or redo log file to the database, the information is recorded in the control files.
Redo Logs
Any database must have at least two redo logs. These are the journals for the database; the redo logs record all changes to the user objects or system objects. If any type of failure occurs, the changes recorded in the redo logs can be used to bring the database to a consistent state without losing any committed transactions. In the case of non-data loss failure, Oracle can apply the information in the redo logs automatically without intervention from the DBA.
The redo log files are fixed in size and never grow dynamically from the size at which they were created.
82. What is ROWID?
The ROWID is a unique database-wide physical address for every row on every table. Once assigned (when the row is first inserted into the database), it never changes until the row is deleted or the table is dropped.
The ROWID consists of the following three components, the combination of which uniquely identifies the physical storage location of the row.
Oracle database file number, which contains the block with the rows
Oracle block address, which contains the row
The row within the block (because each block can hold many rows)
The ROWID is used internally in indexes as a quick means of retrieving rows with a particular key value. Application developers also use it in SQL statements as a quick way to access a row once they know the ROWID
83. What is Oracle Block? Can two Oracle Blocks have the same address?
Oracle "formats" the database files into a number of Oracle blocks when they are first created—making it easier for the RDBMS software to manage the files and easier to read data into the memory areas.
The block size should be a multiple of the operating system block size. Regardless of the block size, the entire block is not available for holding data; Oracle takes up some space to manage the contents of the block. This block header has a minimum size, but it can grow.
These Oracle blocks are the smallest unit of storage. Increasing the Oracle block size can improve performance, but it should be done only when the database is first created.
Each Oracle block is numbered sequentially for each database file starting at 1. Two blocks can have the same block address if they are in different database files.
84. What is database Trigger?
A database trigger is a PL/SQL block that can defined to automatically execute for insert, update, and delete statements against a table. The trigger can e defined to execute once for the entire statement or once for every row that is inserted, updated, or deleted. For any one table, there are twelve events for which you can define database triggers. A database trigger can call database procedures that are also written in PL/SQL.
85. Name two utilities that Oracle provides, which are use for backup and recovery.
Along with the RDBMS software, Oracle provides two utilities that you can use to back up and restore the database. These utilities are Export and Import.
The Export utility dumps the definitions and data for the specified part of the database to an operating system binary file. The Import utility reads the file produced by an export, recreates the definitions of objects, and inserts the data
If Export and Import are used as a means of backing up and recovering the database, all the changes made to the database cannot be recovered since the export was performed. The best you can do is recover the database to the time when the export was last performed.
86. What are stored-procedures? And what are the advantages of using them.
Stored procedures are database objects that perform a user defined operation. A stored procedure can have a set of compound SQL statements. A stored procedure executes the SQL commands and returns the result to the client. Stored procedures are used to reduce network traffic.
87. How are exceptions handled in PL/SQL? Give some of the internal exceptions' name
PL/SQL exception handling is a mechanism for dealing with run-time errors encountered during procedure execution. Use of this mechanism enables execution to continue if the error is not severe enough to cause procedure termination.
The exception handler must be defined within a subprogram specification. Errors cause the program to raise an exception with a transfer of control to the exception-handler block. After the exception handler executes, control returns to the block in which the handler was defined. If there are no more executable statements in the block, control returns to the caller.
User-Defined Exceptions
PL/SQL enables the user to define exception handlers in the declarations area of subprogram specifications. User accomplishes this by naming an exception as in the following example:
ot_failure EXCEPTION;
In this case, the exception name is ot_failure. Code associated with this handler is written in the EXCEPTION specification area as follows:
EXCEPTION
when OT_FAILURE then
out_status_code := g_out_status_code;
out_msg := g_out_msg;
The following is an example of a subprogram exception:
EXCEPTION
when NO_DATA_FOUND then
g_out_status_code := 'FAIL';
RAISE ot_failure;
Within this exception is the RAISE statement that transfers control back to the ot_failure exception handler. This technique of raising the exception is used to invoke all user-defined exceptions.
System-Defined Exceptions
Exceptions internal to PL/SQL are raised automatically upon error. NO_DATA_FOUND is a system-defined exception. Table below gives a complete list of internal exceptions.
PL/SQL internal exceptions.
Exception Name
Oracle Error
CURSOR_ALREADY_OPEN ORA-06511
DUP_VAL_ON_INDEX ORA-00001
INVALID_CURSOR ORA-01001
INVALID_NUMBER ORA-01722
LOGIN_DENIED ORA-01017
NO_DATA_FOUND ORA-01403
NOT_LOGGED_ON ORA-01012
PROGRAM_ERROR ORA-06501
STORAGE_ERROR ORA-06500
TIMEOUT_ON_RESOURCE ORA-00051
TOO_MANY_ROWS ORA-01422
TRANSACTION_BACKED_OUT ORA-00061
VALUE_ERROR ORA-06502
ZERO_DIVIDE ORA-01476
In addition to this list of exceptions, there is a catch-all exception named OTHERS that traps all errors for which specific error handling has not been established.
88. Does PL/SQL support "overloading"? Explain
The concept of overloading in PL/SQL relates to the idea that you can define procedures and functions with the same name. PL/SQL does not look only at the referenced name, however, to resolve a procedure or function call. The count and data types of formal parameters are also considered.
PL/SQL also attempts to resolve any procedure or function calls in locally defined packages before looking at globally defined packages or internal functions. To further ensure calling the proper procedure, you can use the dot notation. Prefacing a procedure or function name with the package name fully qualifies any procedure or function reference.
89. Tables derived from the ERD
a) Are totally unnormalised
b) Are always in 1NF
c) Can be further denormalised
d) May have multi-valued attributes
(b) Are always in 1NF
90. Spurious tuples may occur due to
i. Bad normalization
ii. Theta joins
iii. Updating tables from join
a) i & ii b) ii & iii
c) i & iii d) ii & iii
(a) i & iii because theta joins are joins made on keys that are not primary keys.
91. A B C is a set of attributes. The functional dependency is as follows
AB -> B
AC -> C
C -> B
a) is in 1NF
b) is in 2NF
c) is in 3NF
d) is in BCNF
(a) is in 1NF since (AC)+ = { A, B, C} hence AC is the primary key. Since C B is a FD given, where neither C is a Key nor B is a prime attribute, this it is not in 3NF. Further B is not functionally dependent on key AC thus it is not in 2NF. Thus the given FDs is in 1NF.
92. In mapping of ERD to DFD
a) entities in ERD should correspond to an existing entity/store in DFD
b) entity in DFD is converted to attributes of an entity in ERD
c) relations in ERD has 1 to 1 correspondence to processes in DFD
d) relationships in ERD has 1 to 1 correspondence to flows in DFD
(a) entities in ERD should correspond to an existing entity/store in DFD
93. A dominant entity is the entity
a) on the N side in a 1 : N relationship
b) on the 1 side in a 1 : N relationship
c) on either side in a 1 : 1 relationship
d) nothing to do with 1 : 1 or 1 : N relationship
(b) on the 1 side in a 1 : N relationship
94. Select 'NORTH', CUSTOMER From CUST_DTLS Where REGION = 'N' Order By
CUSTOMER Union Select 'EAST', CUSTOMER From CUST_DTLS Where REGION = 'E' Order By CUSTOMER
The above is
a) Not an error
b) Error - the string in single quotes 'NORTH' and 'SOUTH'
c) Error - the string should be in double quotes
d) Error - ORDER BY clause
(d) Error - the ORDER BY clause. Since ORDER BY clause cannot be used in UNIONS
95. What is Storage Manager?
It is a program module that provides the interface between the low-level data stored in database, application programs and queries submitted to the system.
96. What is Buffer Manager?
It is a program module, which is responsible for fetching data from disk storage into main memory and deciding what data to be cache in memory.
97. What is Transaction Manager?
It is a program module, which ensures that database, remains in a consistent state despite system failures and concurrent transaction execution proceeds without conflicting.
98. What is File Manager?
It is a program module, which manages the allocation of space on disk storage and data structure used to represent information stored on a disk.
99. What is Authorization and Integrity manager?
It is the program module, which tests for the satisfaction of integrity constraint and checks the authority of user to access data.
100. What are stand-alone procedures?
Procedures that are not part of a package are known as stand-alone because they independently defined. A good example of a stand-alone procedure is one written in a SQL*Forms application. These types of procedures are not available for reference from other Oracle tools. Another limitation of stand-alone procedures is that they are compiled at run time, which slows execution.
101. What are cursors give different types of cursors.
PL/SQL uses cursors for all database information accesses statements. The language supports the use two types of cursors
Implicit
Explicit
102. What is cold backup and hot backup (in case of Oracle)?
Cold Backup:
It is copying the three sets of files (database files, redo logs, and control file) when the instance is shut down. This is a straight file copy, usually from the disk directly to tape. You must shut down the instance to guarantee a consistent copy.
If a cold backup is performed, the only option available in the event of data file loss is restoring all the files from the latest backup. All work performed on the database since the last backup is lost.
Hot Backup:
Some sites (such as worldwide airline reservations systems) cannot shut down the database while making a backup copy of the files. The cold backup is not an available option.
So different means of backing up database must be used — the hot backup. Issue a SQL command to indicate to Oracle, on a tablespace-by-tablespace basis, that the files of the tablespace are to backed up. The users can continue to make full use of the files, including making changes to the data. Once the user has indicated that he/she wants to back up the tablespace files, he/she can use the operating system to copy those files to the desired backup destination.
The database must be running in ARCHIVELOG mode for the hot backup option.
If a data loss failure does occur, the lost database files can be restored using the hot backup and the online and offline redo logs created since the backup was done. The database is restored to the most consistent state without any loss of committed transactions.
103. What are Armstrong rules? How do we say that they are complete and/or sound
The well-known inference rules for FDs
Reflexive rule :
If Y is subset or equal to X then X Y.
Augmentation rule:
If X Y then XZ YZ.
Transitive rule:
If {X Y, Y Z} then X Z.
Decomposition rule :
If X YZ then X Y.
Union or Additive rule:
If {X Y, X Z} then X YZ.
Pseudo Transitive rule :
If {X Y, WY Z} then WX Z.
Of these the first three are known as Amstrong Rules. They are sound because it is enough if a set of FDs satisfy these three. They are called complete because using these three rules we can generate the rest all inference rules.
104. How can you find the minimal key of relational schema?
Minimal key is one which can identify each tuple of the given relation schema uniquely. For finding the minimal key it is required to find the closure that is the set of all attributes that are dependent on any given set of attributes under the given set of functional dependency.
Algo. I Determining X+, closure for X, given set of FDs F
1. Set X+ = X
2. Set Old X+ = X+
3. For each FD Y Z in F and if Y belongs to X+ then add Z to X+
4. Repeat steps 2 and 3 until Old X+ = X+
Algo.II Determining minimal K for relation schema R, given set of FDs F
1. Set K to R that is make K a set of all attributes in R
2. For each attribute A in K
a. Compute (K – A)+ with respect to F
b. If (K – A)+ = R then set K = (K – A)+
105. What do you understand by dependency preservation?
Given a relation R and a set of FDs F, dependency preservation states that the closure of the union of the projection of F on each decomposed relation Ri is equal to the closure of F. i.e.,
((R1(F)) U … U (Rn(F)))+ = F+
if decomposition is not dependency preserving, then some dependency is lost in the decomposition.
106. What is meant by Proactive, Retroactive and Simultaneous Update.
Proactive Update:
The updates that are applied to database before it becomes effective in real world .
Retroactive Update:
The updates that are applied to database after it becomes effective in real world .
Simulatneous Update:
The updates that are applied to database at the same time when it becomes effective in real world .
107. What are the different types of JOIN operations?
Equi Join: This is the most common type of join which involves only equality comparisions. The disadvantage in this type of join is that there
Important C Answers for Interview
1. What does static variable mean?
When a variable is declared to static it will be initialized the default value zero. It is local to the block in which it is declared. The lifetime persists for each and every function call.
2. What is a pointer?
A pointer is also called a reference of a particular data type. But instead of storing some value it stores the address of a particular variable. This address can be initialized by using “&” operator. Eg: int a = &b;
3. What is a structure?
Structure is a special type of user defined data structure which comprises of a collection of certain type predefined data types like int, char, float etc. It is an entity which comprises of many atoms.
4. What are differences between structure and array?
Arrays are group of data of same data type, whereas structure is combination of entities of different data types. Size of array needs to be declared initially itself whereas structure can be done both initially and dynamically.
5. In header files whether functions are declared or defined?
Inside header files the functions are defined and they are not declared. This is also a type of structure definition.
6. What are the differences between malloc() and calloc()?
malloc() takes a single argument(memory required in bytes), while calloc() needs 2 arguments(number of variables to allocate memory, size in bytes of a single variable). Secondly, malloc() doesnot initialize the memory allocated, while calloc() initializes the allocated memory to ZERO. The difference b/w malloc and calloc are: 1. malloc() allocates byte of memory where as calloc()allocates block of memory.
7. What are macros? What are its advantages and disadvantages?
Macros are short form for macro definition. These macro names are handled by the pre processor and it replaces the corresponding definition. Macros increase the speed of execution whereas they also increase the size of the program.
8. Differences between pass by reference and pass by value
Whenever we call a function if we pass the value of the variable with it, it is called call by value. Whereas, if we pass the address were the variable is stored it is called, call by reference.
In C the names of variables, functions, labels etc are named as identifiers. Similarly static is also an identifier which is used to initialize value to some data types.
Even if variables are not declared auto by default they are taken to be auto. When initialized auto variables are stored in the memory it is local to the block in which it is declared, its default value is garbage.
11. Where does global, static, local, register variables, free memory and c Program instructions get stored?
Local Variables are stored in Stack. Register variables are stored in Register. Global & static variables are stored in data segment. The memory created dynamically are stored in Heap And the C program instructions get stored in code segment.
12. Difference between arrays and linked list?
Arrays are initialized statically whereas linked list is initialized dynamically using pointers. Arrays are easy to create and use but creating linked list is tough. Arrays must be contiguous memory locations but in linked list they can be at different places.
13. What are enumerations?
Enumeration is the process by which we can declare what values a particular variable of a defined data type can take.
14. Describe about storage allocation and scope of global, extern, static, local and register variables?
The extern storage type is used to allow a source module within a C program to access a variable declared in another source module.
Static variables are only accessible within the code block that declared them, and additionally if the variable is local, rather than global, they retain their old value between subsequent calls to the code block.
Register variables are stored within CPU registers where ever possible, providing the fastest possible access to their values.
15. What are register variables? What are the advantages of using register variables?
Register variables is another type of storage class in C. When declared of this type it gets stored inside the CPU registers. Whenever we are going to use a variable at many places it is useful in declaring it as register because it will increase the speed of execution.
16. What is the use of typedef?
Typedef is used in re declaring the variables. When ever big variable declarations are present they can be substituted using typedef. Eg: typedef unsigned long int TWO;. Whenever we want to use unsigned long int we can just use TWO. Eg: TWO var1, var2;
17. Can we specify variable field width in a scanf() format string? If possible how?
Yes we can specify variable filed width within a scanf format string. An example is here we restrict string of length greater than size 20 using this statement. scanf(“%20s”, address).
18. Out of fgets() and gets() which function is safe to use and why?
Out of fgets() and gets(), fgets() is safer because of the following reason. Fgets() reads from the file buffer until the beginning of a new line or until EOF. Whereas, in gets() it is the users work to specify length and gets() also has the danger of overrunning.
19. Difference between strdup() and strcpy()?
Strcpy() is used to copy one string to another in his case we have to pass two values source and destination. Whereas. In strdup() it duplicates the string and source and destination values need not be passed.
20. What is recursion?
The processes were a particular function calls itself again and again until a condition is meet is called as recursion. For example the factorial value can be calculated using recursive
21. Differentiate between for loop and a while loop?
We have to initialize values outside the while loop check condition and then increment inside the while loop. Whereas all three steps can be done together inside a single for loop.
22. What are different storage classes in C?
C provides four storage types; ‘extern’, ‘static’, ‘auto’ and ‘register’.
23. Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
a[i] == *(a+i)
a[i][j] == *(*(a+i)+j)
a[i][j][k] == *(*(*(a+i)+j)+k)
a[i][j][k][l] == *(*(*(*(a+i)+j)+k)+l)
24. What is the difference between structure and union?
Both structure and union are almost similar. But the main difference is how they are stored. In structures many memory locations are grouped together. In unions a single memory location is split into many.
25. What is the advantage of using unions?
Advantage of using union is that it reduces machine dependency. We no longer have to worry about the size of an int, long, float etc.
26. What are the advantages of using pointers in a program?
The advantages of using pointers in programs are, they help in dynamic allocation of variables, they also help in efficient memory utilization ways, etc.
27. What is the difference between Strings and Arrays?
Strings are used to handle a set of character, handling strings is a very important concept. Arrays are nothing but storing of entities of same data type in contiguous memory location. Strings are handles as a array of characters.
28. It is a repeated question
29. What is a far pointer? Where we use it?
Far pointers are the normalized pointers of four bytes which are used to access the main memory of the computer ...it can access both the data segment and code segment thus by modifying the offset u can modify refer two different addresses but refer to the same memory
30. float (*fnp[3])(int, int);
31.What is NULL pointer? Whether it is same as an uninitialized pointer?
Usually a pointer is initialized to NULL. this is to tell that it is still doesn't have valid address. Uninitialized pointer can contain any value (just like any other uninitialized variable), which we call garbage.
32.What is NULL macro? What is the difference between a NULL pointer & a NULL macro?
NULL is a macro which contains the value 0 (on most implementations). this is the one used to initialize a pointer to NULL.
33.What does the error ‘Null Pointer Assignment’ mean and what causes this error?
Null pointer assignment:
This error is displayed when a value is stored to an uninitialized pointer. The program may appear to work properly.
34.What is near,far,huge pointers?How many bytes are occupied by them?
near pointer:
The first version of near declares a pointer to be one word with a range of
64K.
This type modifier is usually used when compiling in the medium, large, or
huge memory models to force pointers to be near.
Example:
char near *s;
int (near *ip)[10];
When near is used with a function declaration, Turbo C++ generates function
code for a near call and a near return.
far pointers:
Forces pointers to be far, generates function code for a far call and a far
return.
Syntax:
þ
The first version of far declares a pointer to be two words with a range of
1 megabyte. This type modifier is usually used when compiling in the tiny,
small, or compact models to force pointers to be far.
Examples:
char far *s;
void * far * p;
When far is used with a function declaration, Turbo C++ generates function
code for a far call and a far return.
huge pointer:
Syntax:
The huge pointer is similar to the far pointer except for two additional
features.
1. Its segment is normalized during pointer
arithmetic so that pointer comparisons are
accurate.
2.Huge pointers can be incremented without
suffering from segment wraparound.
35.How would you obtain segment and offset address from a far address of a memory location?
The segment and offset address can be calculated by means of using the function FP_SEG().The parameter to the function is fp which is the file pointer.It is given as FP_SEG(fp).This function returns the segment and offset address of the given memory location.
36.Are the expressions arr and &arr same for an array of integers?
The __expression arr and &arr are same for an array of integers.
37.Does mentioning the array name gives the base address in all the contexts?
No, not in all contexts. Following is the list of exceptions.
An expression of type “array of type” is converted to type
“pointer to type” unless:
* it is the operand of the sizeof operator, or
* it is the operand of the address-of (&) operator, or
* it is a string literal used to initialize an array.
38. Explain one method to process an entire string as one unit?
Strlen()-This function counts the number of charcters present in a string.
Ex:
main()
{
char arr[]=”London”;
int len;
len=strlen(arr);
printf(“string = %s length=%d”,arr,len);
}
Output:
String= London length=6
39. What is the similarity between a structure, union and enumeration?
The similarity between a structure, union and enumeration is all the three are defined by the user.
40. Can a structure contain a pointer to itself?
Yes, structure can contain a pointer to itself.
typedef struct node {
char *item;
struct node *next;
} *NODEPTR;
41.How can we check whether the contents of two structure variables are same or not?
Two variables of the same structure type can be compared in same way as ordinary variables.
If person1 & person2 belongs to same structure the following operations are valid.
Operation Meaning
Person1=person2 Assign person2 to person1
Person1==person2 Compare all members of person1 &person2 & return 1 if they are equal, zero otherwise.
Person1!=person2 Return 1 if all the member are not equal, zero otherwise.
42. How are structure passing and returning implemented by compiler?
When structures are passed as arguments to functions, the entire structure is typically pushed on the stack, using as many words as are required.
43. How can we read/write structures from/to data files?
We ca n read/write structures from/to data files by using fscanf()&fprintf().
44. What is the difference between enumeration and a set of preprocessor #defines?
#define have a global scope whereas the scope of enum can either be global (if declared outside all function) or local (if declared inside a function).
45. What do the ‘c’ and ‘v’ in argc and argv stand for?
Argc-argument count
Argv-argument vector
46. Are the variables argc and argv are local to main?
Yes, the variables argc and argv are local to main.
47.
48. It is the command interpreter’s job to do the expansion.
49.
50. What are bitfields?What is the use of bitfields in structure declaration?
A bit field is an element of a structure that is defined in terms of bits.Using a special type of struct definition, you can declare a structure element that can range from 1 to 16 bits in length.
For example, this struct
struct bit_field {
int bit_1 : 1;
int bits_2_to_5 : 4;
int bit_6 : 1;
int bits_7_to_16 : 10;
} bit_var;
51. To which numbering system can the binary number 1101100100111100 be easily converted to?
Hexadecimal Numbering System.
52. Which bitwise operator is suitable for checking whether a particular bit is on or off?
Bitwise AND Operator.
53. Which bitwise operator is suitable for turning off a particular bit in a number?
Bitwise AND Operator.
54. Which bitwise operator is suitable for putting on a particular bit in a number?
Bitwise OR Operator.
55. Which bitwise operator is suitable for checking whether a particular bit is on or off?
Bitwise AND Operator.
56.Which is equivalent to multiplying by 2:Left shifting a number by 1 or left shifting an unsigned int or char by 1?
Left shifting a number by 1 is equivalent to multiplying by 2. It is always safe to use unsigned integer operands for bitwise operations, so the second statement will hold good.
57. Write a program to compare two strings without using the strcmp() function?
58.Write a program to concatenate two string?
Program:
#include
void main()
{
char source[]=”folks!”;
char target[30]=”Hello”;
strcat(target,source);
printf(“\nsource string=%s”,source);
printf(“\ntarget string=%s”,target);
}
59.Write a program to interchange two variables without using the third one?
Program:
#include
void main(){
int a,b;
printf("ENTER THE VALUE OF A : ");
scanf("%d",&a);
printf("ENTER THE VALUE OF B : ");
scanf("%d",&b);
if (a>b)
{a=a-b;
b=a+b;
a=b-a;
}
else
{b=b-a;
a=b+a;
b=a-b;}
printf ("A = %d \nB = %d",a,b);
}
60.Write a program for String reversal & palindrome check?
Program:
#include
#include
#include
void main()
{
char str1[20],str2[20];
clrscr();
printf("\nEnter the string: ");
scanf("%s",&str1);
strcpy(str2,str1);
strrev(str1);
61. Write a program to find the Factorial of a number
#include
#define VALUE 6
int i,j;
void main()
{
j=1;
for (i=1; i<=VALUE; i++)
j=j*i;
printf("The factorial of %d is %d\n",VALUE,j);
}
62.Write a program to generate the Fibinocci Series
#include
main()
{ int fib[24];
int i;
fib[0] = 0;
fib[1] = 1;
for(i = 2; i < 24; i++)
fib[i] = fib[i-1] + fib[i-2];
for (i = 0; i < 24; i++)
printf("%3d %6d\n", i, fib[i]);
}
63.Write a program which employs Recursion
Program to display first four multiples of a number
#include
#include
Void multi();
Void main()
{
Int I;
Clrscr();
Multi(10);
Getch();
}
Void multi(int n)
{
If(n<10000)
{
Multi(n*10);
}
Printf(“\n%d”,n);
}
Output:
10000
1000
100
10
64.Write a program which uses Command Line Arguments
Weight Conversion with Command Line Argument
#include
void print_converted(int pounds)
/* Convert U.S. Weight to Imperial and International
Units. Print the results */
{ int stones = pounds / 14;
int uklbs = pounds % 14;
float kilos_per_pound = 0.45359;
float kilos = pounds * kilos_per_pound;
printf(" %3d %2d %2d %6.2f\n",
pounds, stones, uklbs, kilos);
}
main(int argc,char *argv[])
{ int pounds;
if(argc != 2)
{ printf("Usage: convert weight_in_pounds\n");
exit(1);
}
sscanf(argv[1], "%d", £s); /* Convert String to int */
printf(" US lbs UK st. lbs INT Kg\n");
print_converted(pounds);
}
65.Write a program which uses functions like strcmp(), strcpy()? etc
#include
#include
/* this function is designed to remove the newline from the end of a string
entered using fgets. Note that since we make this into its own function, we
could easily choose a better technique for removing the newline. Aren't
functions great? */
void strip_newline( char *str, int size )
{
int i;
/* remove the null terminator */
for ( i = 0; i < size; ++i )
{
if ( str[i] == '\n' )
{
str[i] = '\0';
/* we're done, so just exit the function by returning */
return;
}
}
/* if we get all the way to here, there must not have been a newline! */
}
int main()
{
char name[50];
char lastname[50];
char fullname[100]; /* Big enough to hold both name and lastname */
printf( "Please enter your name: " );
fgets( name, 50, stdin );
/* see definition above */
strip_newline( name, 50 );
/* strcmp returns zero when the two strings are equal */
if ( strcmp ( name, "Alex" ) == 0 )
{
printf( "That's my name too.\n" );
}
else
{
printf( "That's not my name.\n" );
}
// Find the length of your name
printf( "Your name is %d letters long", strlen ( name ) );
printf( "Enter your last name: " );
fgets( lastname, 50, stdin );
strip_newline( lastname, 50 );
fullname[0] = '\0';
/* strcat will look for the \0 and add the second string starting at
that location */
strcat( fullname, name ); /* Copy name into full name */
strcat( fullname, " " ); /* Separate the names by a space */
strcat( fullname, lastname ); /* Copy lastname onto the end of fullname */
printf( "Your full name is %s\n",fullname );
getchar();
return 0;
}
66.What are the advantages of using typedef in a program?
A good programming practice is using typedef while instantiating template classes. Then throughout the program, one can use the typedef name. There are two advantages:
• typedef's are very useful when "templates of templates" come into usage. For example, when instantiating an STL vector of int's, you could use:
typedef vector<int, allocator<int> > INTVECTOR ;
• If the template definition changes, simply change the typedef definition. For example, currently the definition of template class vector requires a second parameter.
typedef vector<int, allocator<int> > INTVECTOR ;
INTVECTOR vi1 ;
67.How would you dynamically allocate a one-dimensional and two-dimensional array of integers?
int **arrayPtr;
int numRows, numCols;
printf("Enter values for numRows and numCols\n");
scanf("%d",&numRows);
scanf("%d",&numCols);
/* Create space for first array (array of pointers to each row). */
arrayPtr = (int **) malloc(numRows*sizeof(int));
/* Loop through first array and create space for according to number of columns.*/
for(rowIndex=0;rowIndex < numRows;rowIndex++)
arrayPtr[rowIndex] = malloc(numCols*sizeof(int));
The easiest way to create a dynamically allocated array is to first dynamically allocate an array of pointers, of length equal to the number of rows desired, and then have each entry in that array point to a dynamically allocated array of length equal to the number of columns.
The following example allocates a dynamic array of characters with eight rows and 5 columns.
main()
{
char **myArray; // eek, char ** because myArray is a pointer to a
// pointer to a character (an array of arrays...)
myArray = new char * [8]; // allocate the rows
for (int row = 0; row < 8; row++) // now allocate the columns
myArray[i] = new char [5];
}
68.How can you increase the size of a dynamically allocated array?
Realloc() function is used to resize the memory block,which is already allocated.
Syntax: ptr_var=realloc(ptr_var,new_size);
69.How can you increase the size of a statically allocated array?
Required amount of memory is allocated to program elements at start of the program. memory value is fixed and identified by compiler at compile time. So statically allocated memory size cannot be resized.
70.When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
If you have a pointer to a malloc'd section of memory and you realloc it, the pointer still points to the right addrss, but the actual address *may* change.
71.Which function should be used to free the memory allocated by calloc()?
The Free() function
Syntax: free(ptr_var);
72.How much maximum can you allocate in a single call to malloc()?
Depending upon the amount of free memory in the ram,the size is allocated to malloc in single call. To check whether requested memory is available the following program is used..
Int ptr*;
Prt=(int*)malloc(5*sizeof(int));
If (prt==NULL)
{
Printf(“required memory not available”);
Getch();exit(0);
}
73.Can you dynamically allocate arrays in expanded memory?
======
74.What is object file? How can you access object file?
The compiler compiles the error free source code and coverts them into byte code format and this file is called the object file. Thus the text editor produces .c source files, which go to the compiler, which produces .obj object files, which go to the linker, which produces .exe executable file
75.Which header file should you include if you are to develop a function which can accept variable number of arguments?
Stat.h
76.Can you write a function similar to printf()?
The library function sprintf() is similar to printf() only the formatted output is written to a memory area rather than directly to standard output. It is particularly useful when it is necessary to construct formatted strings in memory for subsequent transmission over a communications channel or to a special device
main()
{
char buf[128];
double x = 1.23456;
char *spos = buf;
int i = 0;
sprintf(buf,"x = %7.5lf",x);
while(i<10) puts(spos+i++);
}
OUTPUT:
x = 1.23456
= 1.23456
= 1.23456
1.23456
1.23456
.23456
23456
3456
456
56
77.How can a called function determine the number of arguments that have been passed to it?
Depending upon the number of arguments passed the called function will be selected accordingly.
Ex: a)void volume(int length,int breath,int height)
b)void volume(int length,int breath)
When a=volume(2,3) then [b] will be called. If a=volume(3,6,7) then [a] will be called.
78.Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
79.How do you declare the following:
o An array of three pointers to chars
char *name[] = { "Dave","Bert","Alf" };
o An array of three char pointers
o A pointer to array of three chars
o A pointer to function which receives an int pointer and returns a float pointer
o A pointer to a function which receives nothing and returns nothing
80.What do the functions atoi(), itoa() and gcvt() do?
• gcvtConvert floating point value to string
• * itoaConvert integer to string
• atoiConvert string to integer
81.Does there exist any other function which can be used to convert an integer or a float to a string?
• ecvtConvert floating point value to string
• * fcvtConvert floating point value to string
82.How would you use qsort() function to sort an array of structures?
qsort will sort an array of elements. This is a wild function that uses a pointer to another function that performs the required comparisons.
Library : stdlib.h
Prototype : void qsort(void *base,
size_t num,
size_t size,
int (*comp_func)(const void *, const void *))
83.How would you use qsort() function to sort the name stored in an array of pointers to string?
void *qsort(const void *base, size_t nmemb,
size_t size,
int (*compar)(const void *, const void *));
void Person_dbase::list(Listtype type)
{
switch (type)
{
case list_by_name:
qsort(pp, n, sizeof(Person), (pif2vp)cmpname);
break;
case list_by_birthday:
qsort(pp, n, sizeof(Person), (pif2vp)cmpdate);
break;
} // list the sorted Person-database
}
84.How would you use bsearch() function to search a name stored in array of pointers to string?
void *bsearch(const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
85.How would you use the functions sin(), pow(), sqrt()?
#include
sin():
double sin(double x);
sin()- gives the trignometrical sin value of x which is in radian.
pow():
double sqrt(double x);
sqrt() returns the non-negative square root of x. The value of x must
not be negative.
sqrt():
float powf(float x, float y);
pow() returns x^y. If x is 0.0, y must be positive. If x is
negative, y must be an integer.
86.How would you use the functions memcpy(), memset(), memmove()?
Declaration: memcpy():
void *memcpy(void *str1, const void *str2, size_t n);
Copies n characters from str2 to str1. If str1 and str2 overlap the behavior is undefined.
Declaration: memset():
void *memset(void *str, int c, size_t n);
Copies the character c (an unsigned char) to the first n characters of the string pointed to by the argument str.
Declaration: memmove():
void *memmove(void *str1, const void *str2, size_t n);
Copies n characters from str2 to str1. If str1 and str2 overlap the information is first completely read from str1 and then written to str2 so that the characters are copied correctly.
87.How would you use the functions fseek(), fread(), fwrite() and ftell()?
Fseek():
int fseek(FILE *stream, long offset, int mode);
The function sets the file-position indicator for the stream stream (as specified by offset and mode), clears the end-of-file indicator for the stream, and returns zero if successful.
Fread():
size_t fread(void *ptr, size_t size, size_t nelem, FILE *stream);
The function reads characters from the input stream stream and stores them in successive elements of the array whose first element has the address (char *)ptr until the function stores size*nelem characters or sets the end-of-file or error indicator. It returns n/size, where n is the number of characters it read. If n is not a multiple of size, the value stored in the last element is indeterminate. If the function sets the error indicator, the file-position indicator is indeterminate.
Fwrite():
size_t fwrite(const void *ptr, size_t size, size_t nelem, FILE *stream);
The function writes characters to the output stream stream, accessing values from successive elements of the array whose first element has the address (char *)ptr until the function writes size*nelem characters or sets the error indicator. It returns n/size, where n is the number of characters it wrote. If the function sets the error indicator, the file-position indicator is indeterminate.
Ftell():
long ftell(FILE *stream);
The function returns an encoded form of the file-position indicator for the stream stream or stores a positive value in errno and returns the value -1. For a binary file, a successful return value gives the number of bytes from the beginning of the file. For a text file, target environments can vary on the representation and range of encoded file-position indicator values.
88.How would you obtain the current time and difference between two times?
BY USING TIMERELATED FUNCTIONS
Time() - Gets current system time as long integer
Difftime - Computes the difference between two times
89.How would you use the functions randomize() and random()?
int randno = random(n);
It then returns a random whole number in the range 0 to n-1
BY using randomize() - Initializes random number generation with a random value based on time.
90.How would you implement a substr() function that extracts a sub string from a given string?
substr(s,p)-- return substring of s starting at position p
91.What is the difference between the functions rand(), random(), srand() and randomize()?
srand ... Sets a new random seed for rand
rand ... returns a pseudo-random number (using the seed from srand
call)
random and srandom are pretty mucht the same as rand and srand but the
have a better alorithm -> the numbers are more random
randomize is probably a Borland specific function
92.What is the difference between the functions memmove() and memcpy()?
memmove() – Copies n characters from str2 to str1. If str1 and str2 overlap the behavior is undefined
memcpy() – Copies n characters from str2 to str1. If str1 and str2 overlap the information is first completely read from str1 and then written to str2 so that the characters are copied correctly
93.How do you print a string on the printer?
BY USING: stdprn()-[standard printer] function.
94.Can you use the function fprintf() to display the output on the screen?
yes it is possible .
Important Interview HR questions
*************************HR QUESTIONS**************************************
Q1.Define Yourself?
Don’t mention about your family out here.
Don’t mention your percentage they don’t define you.
Mention your name, college, branch and name of your school.
Mention your achievements.
Mention your hobbies.
Mention your strength and weaknesses as well as what you are doing to overcome that weakness.
Q2. What do you expect from the company?
Ans:
Always keep knowledge about the company you are going for.
Try to know their goals
Don’t put up high.
Don’t talk about the salary.
The answer should be something like “ I expect the company to provide me with a healthy environment and a motivating work culture, Wherein I can utilize my capabilities and resources fruitfully.”
Q3. How do you Deal with tough people?
Ans:
It is said that “ A humble smile melts the stone”. Ill try to apply it practically. Ill try to humbly motivate and convince that person because” You can motivate a tiger to eat grass the only thing you have to do for it is to prove him that it’s a living thing”
Q4. What is opinion about brain drain?
Ans:
Its true that India faces the problem of brain drain but I don’t think it to be a vital problem because today we see everything globally. And we work for the global market and are more of a global citizen. My first law is to work for the humanity not nationality. Nationality comes later.
Q5.What are your strengths and weaknesses?
Ans:
Your strength should include your moral values
Weakness should be accompanied by a solution to overcome it.
Don’t mention more than 2 weaknesses.
Q6. Why do you want to join our company?
Ans:
Tell them that your goals and objectives matches to that of the company.
( But for this you need to have a prior idea about what is the company’s goals.)
Give them references of some people who are working in the company and say that the working environment as said by the references suits you and it is one of the company you always wanted to work for.
Q7. What do you believe in Destiny or hard work? And why?
Ans:
I am alive because its my destiny but the way I’ll be leading my life will depend on my hard work . So I believe in both of them because both of them are important in ones life.
Q8. Who serves the country more, a scientist or an engineer?
Ans:
A scientist works on an hypothesis and creates a principle and an engineer works on the principle to create a wonder. Though both are indispensable but an engineer serves the country more because one principle has hundreds of application and it’s the engineer who discovers these applications.
Q9. What is the difference between a goal and a dream?
Ans:
According to me “When I sleep I dream of a goal and when I am awake I accomplish it” or “I dream a dream each day to dream a dream each day , I work for a goal each day and reach a goal each day”.
This answer will depend totally upon your personality.
Q10. Why are you interested to work in a Software company?
Ans: You should state your own reason out here speak your heart. But avoid saying things like it fetches lot of money or more money than other fields.
Q11.Where do you see yourself after five years?
Ans:
After five years I see myself as a person who has worked honestly and as a person who has contributed to the company and the society enough to play a key role in it. I don’t expect to be in the limelight but I expect to be rewarded appropriately for my hard work.
Q12. Which is better public sector or a private sector? And why?
Ans:
There are always 2 sides of a coin and both the sectors have both sides. The positive side as well as the negative side. In public sector it’s the contacts and influences that work more than hard work does where as in Private sector the work is all that matters. As I am a hardworking person and believe in working I will prefer private sector job over public sector because I see more opportunities out here in private sector.
Q13. In which sector should government spend more-Education or health care and why??
Ans: Though both the sector need investment by the government but education should be the priority because its by education that a person comes to know about general hygiene and thus tries to protect himself from various diseases. Education also raises the living standard of a person and hence he is more capable and does not suffer from malnutrition.
Q14. Who is the biggest victim of crime today Women or men? And why?
Ans:
With the rise in living standard and materialistic demands women and men both serve as the victim to crime. But women being the weaker sect suffers the most.
Q15. Where should we spend more money- Development or defense?
Ans:
We should spend more on development as only when we are developed enough we can defend it well. As its said “Development is necessary for enlightening the mind” So by developing we will make our citizens more aware so that they can defend themselves.
Q16.Should computer be a compulsory subject in schools?
Ans:
Yes It should be a compulsory subject in schools, As with the changing era most of the basic operations have been computerized and to work on the very same level students of school should be given knowledge of computers so that they are aware and ease to operation is there.
OR
Yes because today like general science, computer is also used in day to day life so when we are teaching them general sciences why should we miss out computer science.
Q17.Why should we select you?
Ans:
Don’t say things like because “I am the best”.
Say about your qualities and how those qualities fit the best in the company’s requirement.
Here you have a good chance to boast about your moral values
Q18. What do you know about our company?
Ans:
Always have a prior knowledge about the company .
Be attentive when they are giving ppt it will avail you with certain facts which you might have missed out.
Don’t talk about their image in the share market.
Q19. If we don’t select you which company will you prefer?
Ans:
Don’t name any company out here.
Tell them that you will prefer a company which will help you in your growth and which will provide a healthy and a competitive environment.
Don’t say stuffs like” A company which will pay me more”.