Вы находитесь на странице: 1из 3

Below are few interview questions concerned with DBMS.

These questions will test your understanding of concepts revolving around DBMS. Question 1 In context of DBMS and its utilizing programs how you can explain the difference between Data and Information ? Answer 1 Data can be considered as raw facts while information can be said as processed data conveying some meaning. DBMS store data subject to certain constraints that maintain the integrity while utilizing programs derive information out of this data through queries issued by them. Question 2 What is called metadata in context of DBMS ? Give a simple example. Answer 2 Any data that gives information describing the database objects can be said as metadata. For example consider a database D with tables T1 and T2. Now if a third table TM stores the names and data types of columns in T1 and T2, then TM is said to contain metadata i.e data about data. Note : Generally all databases will have metadata storage about underlying databases, the structures within them etc. Metadata can also be user defined as in our example. Question 3 What would happen if there is no rollback mechanism (undo mechanism) in databases. Tell with an example ? Answer 3 Consider a bank transaction. Consider a table TBALANCE storing current balances in accounts and other table TINTEREST storing the calculated interest rate for any account balance at given point in time. If a person visits ATM and withdraws some amount from his account this data need to be reflected in both these tables. If the current balance is deducted from TBALANCE but if there is some technical problem that prevents the interest rate correction in TINTEREST then the entire transaction is invalid. In this case the ATM should not deliver the cash. Also the data update in TBALANCE has to be rolled back to the previous value so that he can try again from start. If there is no rollback mechanism, the data integrity will be lost which will result in a conflict between balance and interest rate.

1) In a professional environment if you know that a program can be written using several levels of nested if statements, what would be your logical step ? Generally in professional environments, the readability of the code would be given very high priority. Generally nested if statements are not easily readable. Hence, a logical step would be to looking to break the nested if into simpler IF blocks by reducing levels as far as possible. 2) What is called a 'dead code' in terms of flow control statements ? Can you give an example in C ? Consider the below example in C if(1 > 2) { printf("will not be executed"); } else { printf("active code"); } In the above C code, the first printf statement will never get executed as 1 is obviously lesser than 2 at any given point in time. These kinds of statements which will never get executed regardless of time of execution are considered to be dead. 3) Can C programs be written without loop statements at all. Can you tell with an example the difficulty presented by not using loop statements at all ? C programs can very well be written without any loop statements like FOR loop, WHILE loop, DO WHILE loop etc. But they adversely affect the lines of code (LOC) and programmers efforts. For example, if you were to print first 500 even natural numbers, you would require at least 500 LOC to complete. On the other hand the solution would be very straightforward and simple when using a loop statement. 4) How C Functions prevent rework and hence save programmers time? When a C program employs functions rather than sequential lines of code, any change in the function's logic would be easy to make as it has to be done at only one place, namely the function definition. Hence the rework effort in case of program logic changes or program debugging becomes much easier.

C++ as everyone knows has evolved from C and retains several features of C. However, there are several differences some of which are very prominent and others which often go unnoticed unless otherwise you get a compilation error. Below are three questions for your practice. Though you may not exact similar questions on placement papers/interviews, reading these types of questions will help to improve your understanding and make you stay prepared to tackle the conventional questions very comfortably. Question 1 In terms of syntax, what is a simple difference between struct declarations between C and C++ ? Answer : In C it is always necessary to include 'struct' keyword while declaring, but you could skip the 'struct' keyword in C++. Example, In C++ : struct_name struct_instance; In C : struct struct_name struct_instance; Question 2 State which of the following statements are true. a) Boolean data type is native in both C and C++ b) Boolean data type is not a fundamental data type in C and C++, c) C++ has boolean data type as a native data type while in C it is not present. Answer : c) C++ has boolean data type as a native data type while in C it is not present. Boolean is not available in C as a fundamental data type. However this can be simulated using enum. Question 3 Which of the following is true regarding exception handling in C and C++ ? a) There is no exception handling in C whereas it exists in C++ b) Function return codes can report errors in C while try catch blocks can be used in C++ c) With advanced libraries try catch blocks can be used in both C and C++ Answer : b) Function return codes can report errors in C while try catch blocks can be used in C++ (The above answer is self explanatory.)

Вам также может понравиться