+ All Categories
Home > Documents > Tech Interview Questions

Tech Interview Questions

Date post: 07-Apr-2018
Category:
Upload: astar-logan
View: 214 times
Download: 0 times
Share this document with a friend

of 77

Transcript
  • 8/6/2019 Tech Interview Questions

    1/77

    INTERVIEW QUESTIONS

    DATA BASE MANAGEMENT SYSTEMS:

    1.Which is the subset of SQL commands used to manipulate Oracle Database structures,

    including tables?Data Definition Language (DDL)

    2.What operator performs pattern matching?

    LIKE operator

    3.What operator tests column for the absence of data?

    IS NULL operator

    4.Which command executes the contents of a specified file?

    START or @

    5.What is the parameter substitution symbol used with INSERT INTO command?

    &

    6.Which command displays the SQL command in the SQL buffer, and then executes it?

    RUN

    7.What are the wildcards used for pattern matching?

    _ for single character substitution and % for multi-character substitution

    8.State true or false. EXISTS, SOME, ANY are operators in SQL.

    True

    9.State true or false. !=, , ^= all denote the same operation.

    True

    10.What are the privileges that can be granted on a table by a user to others?

    Insert, update, delete, select, references, index, execute, alter, all

    11.What command is used to get back the privileges offered by the GRANT command?

    REVOKE

    12.Which system tables contain information on privileges granted and privileges

    obtained?

    SQL

  • 8/6/2019 Tech Interview Questions

    2/77

    USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD

    13.Which system table contains information on constraints on all the tables created?

    USER_CONSTRAINTS

    14. TRUNCATE TABLE EMP;

    DELETE FROM EMP;

    Will the outputs of the above two commands differ?

    Both will result in deleting all the rows in the table EMP.

    15.What is the difference between TRUNCATE and DELETE commands?

    TRUNCATE is a DDL command whereas DELETE is a DML command. Hence

    DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back.

    WHERE clause can be used with DELETE and not with TRUNCATE.

    16.What command is used to create a table by copying the structure of another table?

    Answer :

    CREATE TABLE .. AS SELECT command

    Explanation :

    To copy only the structure, the WHERE clause of the SELECT command should

    contain a FALSE statement as in the following.

    CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE

    WHERE 1=2;

    If the WHERE condition is true, then all the rows or rows satisfying the condition

    will be copied to the new table.

    17.What will be the output of the following query?

    SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'),

    'AN', '**'),'*','TROUBLE') FROM DUAL;

    TROUBLETHETROUBLE

    18.What will be the output of the following query?

    SELECT DECODE(TRANSLATE('A','1234567890','1111111111'), '1','YES', 'NO' );

    Answer :

    NO

    Explanation :

    The query checks whether a given string is a numerical digit.

    19.What does the following query do?

    SELECT SAL + NVL(COMM,0) FROM EMP;

  • 8/6/2019 Tech Interview Questions

    3/77

    This displays the total salary of all employees. The null values in the commission

    column will be replaced by 0 and added to salary.

    20.Which date function is used to find the difference between two dates?

    MONTHS_BETWEEN

    21.Why does the following command give a compilation error?

    DROP TABLE &TABLE_NAME;

    Variable names should start with an alphabet. Here the table name starts with an

    '&' symbol.

    22.What is the advantage of specifying WITH GRANT OPTION in the GRANT

    command?

    The privilege receiver can further grant the privileges he/she has obtained fromthe owner to any other user.

    23.What is the use of the DROP option in the ALTER TABLE command?

    It is used to drop constraints specified on the table.

    24.What is the value of comm and sal after executing the following query if the initial

    value of sal is 10000?

    UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;

    sal = 11000, comm = 1000

    25.What is the use of DESC in SQL?

    Answer :

    DESC has two purposes. It is used to describe a schema as well as to retrieve

    rows from table in descending order.

    Explanation :

    The query SELECT * FROM EMP ORDER BY ENAME DESC will display the

    output sorted on ENAME in descending order.

    26.What is the use of CASCADE CONSTRAINTS?

    When this clause is used with the DROP command, a parent table can be dropped

    even when a child table exists.

    27.Which function is used to find the largest integer less than or equal to a specific

  • 8/6/2019 Tech Interview Questions

    4/77

    value?

    FLOOR

    28.What is the output of the following query?

    SELECT TRUNC(1234.5678,-2) FROM DUAL;

    1200

    SQL QUERIES

    I. SCHEMAS

    Table 1 : STUDIES

    PNAME (VARCHAR), SPLACE (VARCHAR), COURSE (VARCHAR), CCOST

    (NUMBER)

    Table 2 : SOFTWARE

    PNAME (VARCHAR), TITLE (VARCHAR), DEVIN (VARCHAR), SCOST

    (NUMBER), DCOST (NUMBER), SOLD (NUMBER)

    Table 3 : PROGRAMMER

    PNAME (VARCHAR), DOB (DATE), DOJ (DATE), SEX (CHAR), PROF1

    (VARCHAR), PROF2 (VARCHAR), SAL (NUMBER)

    LEGEND :

    PNAME Programmer Name, SPLACE Study Place, CCOST Course Cost, DEVIN Developed in, SCOST Software Cost, DCOST Development Cost, PROF1

    Proficiency 1

    QUERIES :

    1. Find out the selling cost average for packages developed in Oracle.

    2. Display the names, ages and experience of all programmers.

    3. Display the names of those who have done the PGDCA course.

    4. What is the highest number of copies sold by a package?

    5. Display the names and date of birth of all programmers born in April.

  • 8/6/2019 Tech Interview Questions

    5/77

    6. Display the lowest course fee.

    7. How many programmers have done the DCA course.

    8. How much revenue has been earned through the sale of packages developed in C.

    9. Display the details of software developed by Rakesh.

    10. How many programmers studied at Pentafour.

    11. Display the details of packages whose sales crossed the 5000 mark.

    12. Find out the number of copies which should be sold in order to recover the

    development cost of each package.

    13. Display the details of packages for which the development cost has been

    recovered.

    14. What is the price of costliest software developed in VB?

    15. How many packages were developed in Oracle ?

    16. How many programmers studied at PRAGATHI?

    17. How many programmers paid 10000 to 15000 for the course?

    18. What is the average course fee?

    19. Display the details of programmers knowing C.

    20. How many programmers know either C or Pascal?

    21. How many programmers dont know C and C++?

    22. How old is the oldest male programmer?

    23. What is the average age of female programmers?

    24. Calculate the experience in years for each programmer and display along with

  • 8/6/2019 Tech Interview Questions

    6/77

    their names in descending order.

    25. Who are the programmers who celebrate their birthdays during the current

    month?

    26. How many female programmers are there?

    27. What are the languages known by the male programmers?

    28. What is the average salary?

    29. How many people draw 5000 to 7500?

    30. Display the details of those who dont know C, C++ or Pascal.

    31. Display the costliest package developed by each programmer.

    32. Produce the following output for all the male programmers

    Programmer

    Mr. Arvind has 15 years of experience

    KEYS:

    1. SELECT AVG(SCOST) FROM SOFTWARE WHERE DEVIN = 'ORACLE';

    2. SELECT PNAME,TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12)

    "AGE", TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) "EXPERIENCE"

    FROM PROGRAMMER;

    3. SELECT PNAME FROM STUDIES WHERE COURSE = 'PGDCA';

    4. SELECT MAX(SOLD) FROM SOFTWARE;

    5. SELECT PNAME, DOB FROM PROGRAMMER WHERE DOB LIKE

    '%APR%';

    6. SELECT MIN(CCOST) FROM STUDIES;

    7. SELECT COUNT(*) FROM STUDIES WHERE COURSE = 'DCA';

  • 8/6/2019 Tech Interview Questions

    7/77

    8. SELECT SUM(SCOST*SOLD-DCOST) FROM SOFTWARE GROUP BY

    DEVIN HAVING DEVIN = 'C';

    9. SELECT * FROM SOFTWARE WHERE PNAME = 'RAKESH';

    10. SELECT * FROM STUDIES WHERE SPLACE = 'PENTAFOUR';

    11. SELECT * FROM SOFTWARE WHERE SCOST*SOLD-DCOST > 5000;

    12. SELECT CEIL(DCOST/SCOST) FROM SOFTWARE;

    13. SELECT * FROM SOFTWARE WHERE SCOST*SOLD >= DCOST;

    14. SELECT MAX(SCOST) FROM SOFTWARE GROUP BY DEVIN HAVING

    DEVIN = 'VB';

    15. SELECT COUNT(*) FROM SOFTWARE WHERE DEVIN = 'ORACLE';

    16. SELECT COUNT(*) FROM STUDIES WHERE SPLACE = 'PRAGATHI';

    17. SELECT COUNT(*) FROM STUDIES WHERE CCOST BETWEEN 10000

    AND 15000;

    18. SELECT AVG(CCOST) FROM STUDIES;

    19. SELECT * FROM PROGRAMMER WHERE PROF1 = 'C' OR PROF2 = 'C';

    20. SELECT * FROM PROGRAMMER WHERE PROF1 IN ('C','PASCAL') OR

    PROF2 IN ('C','PASCAL');

    21. SELECT * FROM PROGRAMMER WHERE PROF1 NOT IN ('C','C++') AND

    PROF2 NOT IN ('C','C++');

    22. SELECT TRUNC(MAX(MONTHS_BETWEEN(SYSDATE,DOB)/12)) FROM

    PROGRAMMER WHERE SEX = 'M';

    23. SELECT TRUNC(AVG(MONTHS_BETWEEN(SYSDATE,DOB)/12)) FROM

    PROGRAMMER WHERE SEX = 'F';

    24. SELECT PNAME, TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) FROM

  • 8/6/2019 Tech Interview Questions

    8/77

    PROGRAMMER ORDER BY PNAME DESC;

    25. SELECT PNAME FROM PROGRAMMER WHERE TO_CHAR(DOB,'MON') =

    TO_CHAR(SYSDATE,'MON');

    26. SELECT COUNT(*) FROM PROGRAMMER WHERE SEX = 'F';

    27. SELECT DISTINCT(PROF1) FROM PROGRAMMER WHERE SEX = 'M';

    28. SELECT AVG(SAL) FROM PROGRAMMER;

    29. SELECT COUNT(*) FROM PROGRAMMER WHERE SAL BETWEEN 5000

    AND 7500;

    30. SELECT * FROM PROGRAMMER WHERE PROF1 NOT IN('C','C++','PASCAL') AND PROF2 NOT IN ('C','C++','PASCAL');

    31. SELECT PNAME,TITLE,SCOST FROM SOFTWARE WHERE SCOST IN

    (SELECT MAX(SCOST) FROM SOFTWARE GROUP BY PNAME);

    32.SELECT 'Mr.' || PNAME || ' - has ' ||

    TRUNC(MONTHS_BETWEEN(SYSDATE,DOJ)/12) || ' years of experience'

    Programmer FROM PROGRAMMER WHERE SEX = 'M' UNION SELECT

    'Ms.' || PNAME || ' - has ' || TRUNC (MONTHS_BETWEEN

    (SYSDATE,DOJ)/12) || ' years of experience' Programmer FROMPROGRAMMER WHERE SEX = 'F';

    II . SCHEMA :

    Table 1 : DEPT

    DEPTNO (NOT NULL , NUMBER(2)), DNAME (VARCHAR2(14)),

    LOC (VARCHAR2(13)

    Table 2 : EMP

    EMPNO (NOT NULL , NUMBER(4)), ENAME (VARCHAR2(10)),

    JOB (VARCHAR2(9)), MGR (NUMBER(4)), HIREDATE (DATE),

    SAL (NUMBER(7,2)), COMM (NUMBER(7,2)), DEPTNO (NUMBER(2))

    MGR is the empno of the employee whom the employee reports to. DEPTNO is a foreign

    key.

  • 8/6/2019 Tech Interview Questions

    9/77

    QUERIES

    1.List all the employees who have at least one person reporting to them.

    2.List the employee details if and only if more than 10 employees are present in

    department no 10.

    3.List the name of the employees with their immediate higher authority.

    4.List all the employees who do not manage any one.

    5.List the employee details whose salary is greater than the lowest salary of an employee

    belonging to deptno 20.

    6.List the details of the employee earning more than the highest paid manager.

    7.List the highest salary paid for each job.

    8.Find the most recently hired employee in each department.

    9.In which year did most people join the company? Display the year and the number of

    employees.

    10.Which department has the highest annual remuneration bill?

    11.Write a query to display a * against the row of the most recently hired employee.

    12.Write a correlated sub-query to list out the employees who earn more than the

    average salary of their department.

    13.Find the nth maximum salary.

    14.Select the duplicate records (Records, which are inserted, that already exist) in the

    EMP table.

    15.Write a query to list the length of service of the employees (of the form n years and m

    months).

    KEYS:

  • 8/6/2019 Tech Interview Questions

    10/77

    1.SELECT DISTINCT(A.ENAME) FROM EMP A, EMP B WHERE A.EMPNO =

    B.MGR; or SELECT ENAME FROM EMP WHERE EMPNO IN (SELECT MGR

    FROM EMP);

    2.SELECT * FROM EMP WHERE DEPTNO IN (SELECT DEPTNO FROM EMP

    GROUP BY DEPTNO HAVING COUNT(EMPNO)>10 AND DEPTNO=10);

    3.SELECT A.ENAME "EMPLOYEE", B.ENAME "REPORTS TO" FROM EMP A,

    EMP B WHERE A.MGR=B.EMPNO;

    4.SELECT * FROM EMP WHERE EMPNO IN ( SELECT EMPNO FROM EMP

    MINUS SELECT MGR FROM EMP);

    5.SELECT * FROM EMP WHERE SAL > ( SELECT MIN(SAL) FROM EMP GROUPBY DEPTNO HAVING DEPTNO=20);

    6.SELECT * FROM EMP WHERE SAL > ( SELECT MAX(SAL) FROM EMP GROUP

    BY JOB HAVING JOB = 'MANAGER' );

    7.SELECT JOB, MAX(SAL) FROM EMP GROUP BY JOB;

    8.SELECT * FROM EMP WHERE (DEPTNO, HIREDATE) IN (SELECT DEPTNO,

    MAX(HIREDATE) FROM EMP GROUP BY DEPTNO);

    9.SELECT TO_CHAR(HIREDATE,'YYYY') "YEAR", COUNT(EMPNO) "NO. OF

    EMPLOYEES" FROM EMP GROUP BY TO_CHAR(HIREDATE,'YYYY') HAVING

    COUNT(EMPNO) = (SELECT MAX(COUNT(EMPNO)) FROM EMP GROUP BY

    TO_CHAR(HIREDATE,'YYYY'));

    10.SELECT DEPTNO, LPAD(SUM(12*(SAL+NVL(COMM,0))),15)

    "COMPENSATION" FROM EMP GROUP BY DEPTNO HAVING SUM(

    12*(SAL+NVL(COMM,0))) = (SELECT MAX(SUM(12*(SAL+NVL(COMM,0))))

    FROM EMP GROUP BY DEPTNO);

    11.SELECT ENAME, HIREDATE, LPAD('*',8) "RECENTLY HIRED" FROM EMP

    WHERE HIREDATE = (SELECT MAX(HIREDATE) FROM EMP) UNION SELECT

    ENAME NAME, HIREDATE, LPAD(' ',15) "RECENTLY HIRED" FROM EMP

    WHERE HIREDATE != (SELECT MAX(HIREDATE) FROM EMP);

  • 8/6/2019 Tech Interview Questions

    11/77

    12.SELECT ENAME,SAL FROM EMP E WHERE SAL > (SELECT AVG(SAL) FROM

    EMP F WHERE E.DEPTNO = F.DEPTNO);

    13.SELECT ENAME, SAL FROM EMP A WHERE &N = (SELECT COUNT

    (DISTINCT(SAL)) FROM EMP B WHERE A.SAL1) AND A.ROWID!=MIN

    (ROWID));

    15.SELECT ENAME

    "EMPLOYEE",TO_CHAR(TRUNC(MONTHS_BETWEEN(SYSDATE,HIREDATE)/1

    2))||' YEARS '|| TO_CHAR(TRUNC(MOD(MONTHS_BETWEEN (SYSDATE,

    HIREDATE),12)))||' MONTHS ' "LENGTH OF SERVICE" FROM EMP;

    SQL

    SQL is an English like language consisting of commands to store, retrieve, maintain & regulateaccess to your database.

    SQL*PlusSQL*Plus is an application that recognizes & executes SQL commands & specialized SQL*Plus

    commands that can customize reports, provide help & edit facility & maintain system variables.

    NVLNVL : Null value function converts a null value to a non-null value for the purpose of evaluating anexpression. Numeric Functions accept numeric I/P & return numeric values. They are MOD, SQRT,

    ROUND, TRUNC & POWER.

    Date FunctionsDate Functions are ADD_MONTHS, LAST_DAY, NEXT_DAY, MONTHS_BETWEEN &SYSDATE.

    Character FunctionsCharacter Functions are INITCAP, UPPER, LOWER, SUBSTR & LENGTH. Additional functions

    are GREATEST & LEAST. Group Functions returns results based upon groups of rows rather thanone result per row, use group functions. They are AVG, COUNT, MAX, MIN & SUM.

  • 8/6/2019 Tech Interview Questions

    12/77

    TTITLE & BTITLETTITLE & BTITLE are commands to control report headings & footers.

    COLUMNCOLUMN command define column headings & format data values.

    BREAKBREAK command clarify reports by suppressing repeated values, skipping lines & allowing forcontrolled break points.

    COMPUTEcommand control computations on subsets created by the BREAK command.

    SETSET command changes the system variables affecting the report environment.

    SPOOLSPOOL command creates a print file of the report.

    JOINJOIN is the form of SELECT command that combines info from two or more tables.Types of Joins are Simple (Equijoin & Non-Equijoin), Outer & Self join.

    Equijoin returns rows from two or more tables joined together based upon a equality condition in theWHERE clause.

    Non-Equijoin returns rows from two or more tables based upon a relationship other than the equalitycondition in the WHERE clause.

    Outer Join combines two or more tables returning those rows from one table that have no directmatch in the other table.

    Self Join joins a table to itself as though it were two separate tables.

    UnionUnion is the product of two or more tables.

    IntersectIntersect is the product of two tables listing only the matching rows.

  • 8/6/2019 Tech Interview Questions

    13/77

    MinusMinus is the product of two tables listing only the non-matching rows.

    Correlated SubqueryCorrelated Subquery is a subquery that is evaluated once for each row processed by the parent

    statement. Parent statement can be Select, Update or Delete. Use CRSQ to answer multipartquestions whose answer depends on the value in each row processed by parent statement.

    Multiple columnsMultiple columns can be returned from a Nested Subquery.

    Sequences

    Sequences are used for generating sequence numbers without any overhead of locking. Drawback isthat after generating a sequence number if the transaction is rolled back, then that sequence number

    is lost.

    SynonymsSynonyms is the alias name for table, views, sequences & procedures and are created for reasons of

    Security and Convenience.Two levels are Public - created by DBA & accessible to all the users. Private - Accessible to creator

    only. Advantages are referencing without specifying the owner and Flexibility to customize a moremeaningful naming convention.

    Indexes

    Indexes are optional structures associated with tables used to speed query execution and/or guaranteeuniqueness. Create an index if there are frequent retrieval of fewer than 10-15% of the rows in a

    large table and columns are referenced frequently in the WHERE clause. Implied tradeoff is queryspeed vs. update speed. Oracle automatically update indexes. Concatenated index max. is 16

    columns.

    Data typesMax. columns in a table is 255. Max. Char size is 255, Long is 64K & Number is 38 digits.

    Cannot Query on a long column.Char, Varchar2 Max. size is 2000 & default is 1 byte.

    Number(p,s) p is precision range 1 to 38, s is scale -84 to 127.Long Character data of variable length upto 2GB.

    Date Range from Jan 4712 BC to Dec 4712 AD.Raw Stores Binary data (Graphics Image & Digitized Sound). Max. is 255 bytes.

    Mslabel Binary format of an OS label. Used primarily with Trusted Oracle.

    Order of SQL statement execution

    Where clause, Group By clause, Having clause, Order By clause & Select.

    Transaction

  • 8/6/2019 Tech Interview Questions

    14/77

  • 8/6/2019 Tech Interview Questions

    15/77

    Internal Locks & Latches protects the internal database structures. They are automatic.Exclusive Lock allows queries on locked table but no other activity is allowed.

    Share Lock allows concurrent queries but prohibits updates to the locked tables.Row Share allows concurrent access to the locked table but prohibits for a exclusive table lock.

    Row Exclusive same as Row Share but prohibits locking in shared mode.

    Shared Row Exclusive locks the whole table and allows users to look at rows in the table butprohibit others from locking the table in share or updating them.Share Update are synonymous with Row Share.

    DeadlockDeadlock is a unique situation in a multi user system that causes two or more users to waitindefinitely for a locked resource. First user needs a resource locked by the second user and the

    second user needs a resource locked by the first user. To avoid dead locks, avoid using exclusivetable lock and if using, use it in the same sequence and use Commit frequently to release locks.

    Mutating TableMutating Table is a table that is currently being modified by an Insert, Update or Delete statement.

    Constraining Table is a table that a triggering statement might need to read either directly for a SQLstatement or indirectly for a declarative Referential Integrity constraints. Pseudo Columns behaves

    like a column in a table but are not actually stored in the table. E.g. Currval, Nextval, Rowid,Rownum, Level etc.

    SQL*LoaderSQL*Loader is a product for moving data in external files into tables in an Oracle database. To loaddata from external files into an Oracle database, two types of input must be provided to SQL*Loader

    : the data itself and the control file. The control file describes the data to be loaded. It describes theNames and format of the data files, Specifications for loading data and the Data to be loaded

    (optional). Invoking the loader sqlload username/password controlfilename .

    The most important DDL statements in SQL are:

    CREATE TABLE - creates a new database tableALTER TABLE - alters (changes) a database table

    DROP TABLE - deletes a database tableCREATE INDEX - creates an index (search key)

    DROP INDEX - deletes an index

    Operators used in SELECT statements.= Equal

    or != Not equal> Greater than

    < Less than>= Greater than or equal

  • 8/6/2019 Tech Interview Questions

    16/77

    SELECT statements:

    SELECT column_name(s) FROM table_name

    SELECT DISTINCT column_name(s) FROM table_nameSELECT column FROM table WHERE column operator valueSELECT column FROM table WHERE column LIKE pattern

    SELECT column,SUM(column) FROM table GROUP BY columnSELECT column,SUM(column) FROM table GROUP BY column HAVING SUM(column)

    condition valueNote that single quotes around text values and numeric values should not be enclosed in quotes.

    Double quotes may be acceptable in some databases.

    The SELECT INTO Statement is most often used to create backup copies of tables or for

    archiving records.

    SELECT column_name(s) INTO newtable [IN externaldatabase] FROM sourceSELECT column_name(s) INTO newtable [IN externaldatabase] FROM source WHERE

    column_name operator value

    The INSERT INTO Statements:

    INSERT INTO table_name VALUES (value1, value2,....)INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....)

    The Update Statement:

    UPDATE table_name SET column_name = new_value WHERE column_name = some_value

    The Delete Statements:

    DELETE FROM table_name WHERE column_name = some_value

    Delete All Rows:DELETE FROM table_name or DELETE * FROM table_name

    Sort the Rows:

    SELECT column1, column2, ... FROM table_name ORDER BY columnX, columnY, ..SELECT column1, column2, ... FROM table_name ORDER BY columnX DESC

  • 8/6/2019 Tech Interview Questions

    17/77

    SELECT column1, column2, ... FROM table_name ORDER BY columnX DESC, columnY ASC

    The IN operator may be used if you know the exact value you want to return for at least one of

    the columns.

    SELECT column_name FROM table_name WHERE column_name IN (value1,value2,..)

    BETWEEN ... AND

    SELECT column_name FROM table_name WHERE column_name BETWEEN value1 ANDvalue2 The values can be numbers, text, or dates.

    What is the use of CASCADE CONSTRAINTS?When this clause is used with the DROP command, a parent table can be dropped even when a child

    table exists.

    Why does the following command give a compilation error?

    DROP TABLE &TABLE_NAME; Variable names should start with an alphabet. Here the tablename starts with an '&' symbol.

    Which system tables contain information on privileges granted and privileges obtained?

    USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD

    Which system table contains information on constraints on all the tables created?obtained?USER_CONSTRAINTS.

    What is the difference between TRUNCATE and DELETE commands?True

    State true or false. !=, , ^= all denote the same operation?True.

    State true or false. EXISTS, SOME, ANY are operators in SQL?

    True.

    What will be the output of the following query?SELECT REPLACE(TRANSLATE(LTRIM(RTRIM('!! ATHEN !!','!'), '!'), 'AN','**'),'*','TROUBLE') FROM DUAL;?

    TROUBLETHETROUBLE. p>

    What does the following query do?SELECT SAL + NVL(COMM,0) FROM EMP;?

  • 8/6/2019 Tech Interview Questions

    18/77

    This displays the total salary of all employees. The null values in the commission column will bereplaced by 0 and added to salary.

    What is the advantage of specifying WITH GRANT OPTION in the GRANT command?

    The privilege receiver can further grant the privileges he/she has obtained from the owner to any

    other user.

    Which command executes the contents of a specified file?

    START or @.

    What is the value of comm and sal after executing the following query if the initial value of

    sal is 10000 UPDATE EMP SET SAL = SAL + 1000, COMM = SAL*0.1;?sal = 11000, comm = 1000.

    Which command displays the SQL command in the SQL buffer, and then executes it?

    RUN.

    What command is used to get back the privileges offered by the GRANT command?REVOKE.

    What will be the output of the following query?

    SELECT DECODE(TRANSLATE('A','1234567890','1111111111'), '1','YES', 'NO' );?

    NO.Explanation : The query checks whether a given string is a numerical digit.

    Which date function is used to find the difference between two dates?

    MONTHS_BETWEEN.

    What operator performs pattern matching?LIKE operator.

    What is the use of the DROP option in the ALTER TABLE command?It is used to drop constraints specified on the table.

    What operator tests column for the absence of data?

    IS NULL operator.

    What are the privileges that can be granted on a table by a user to others?

    Insert, update, delete, select, references, index, execute, alter, all.

    Which function is used to find the largest integer less than or equal to a specific value?FLOOR.

    Which is the subset of SQL commands used to manipulate Oracle Database structures,

    including tables?Data Definition Language (DDL).

  • 8/6/2019 Tech Interview Questions

    19/77

    What is the use of DESC in SQL?DESC has two purposes. It is used to describe a schema as well as to retrieve rows from table in

    descending order.Explanation :

    The query SELECT * FROM EMP ORDER BY ENAME DESC will display the output sorted on

    ENAME in descending order.

    What command is used to create a table by copying the structure of another table?

    CREATE TABLE .. AS SELECT commandExplanation:

    To copy only the structure, the WHERE clause of the SELECT command should contain a FALSEstatement as in the following.

    CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2;If the WHERE condition is true, then all the rows or rows satisfying the condition will be copied to

    the new table.

    TRUNCATE TABLE EMP; DELETE FROM EMP; Will the outputs of the above twocommands differ?

    Both will result in deleting all the rows in the table EMP..

    What is the output of the following query SELECT TRUNC(1234.5678,-2) FROM DUAL;?

    1200.

    What are the wildcards used for pattern matching.?_ for single character substitution and % for multi-character substitution.

    What is the parameter substitution symbol used with INSERT INTO command?

    &

    What's an SQL injection?

    SQL Injection is when form data contains an SQL escape sequence and injects a new SQL query tobe run.

    What is difference between TRUNCATE & DELETE ?TRUNCATE commits after deleting entire table i.e., cannot be rolled back. Database triggers do notfire on TRUNCATE

    DELETE allows the filtered deletion. Deleted records can be rolled back or committed. Databasetriggers fire on DELETE.

    What is a join? Explain the different types of joins?

    Join is a query, which retrieves related columns or rows from multiple tables.Self Join - Joining the table with itself.

    Equi Join - Joining two tables by equating two common columns.Non-Equi Join - Joining two tables by equating two common columns.Outer Join - Joining two tables in such a way that query can also retrieve rows that do not have

    corresponding join value in the other table.

  • 8/6/2019 Tech Interview Questions

    20/77

    What is the sub-query?Sub-query is a query whose return values are used in filtering conditions of the main query.

    What is correlated sub-query?

    Correlated sub-query is a sub-query, which has reference to the main query.

    Explain CONNECT BY PRIOR?Retrieves rows in hierarchical order eg.

    select empno, ename from emp where.

    Difference between SUBSTR and INSTR?

    INSTR (String1, String2 (n, (m)),INSTR returns the position of the m-th occurrence of the string 2 in string1. The search begins from

    nth position of string1.SUBSTR (String1 n, m)

    SUBSTR returns a character string of size m in string1, starting from n-th position of string1.

    Explain UNION, MINUS, UNION ALL and INTERSECT?INTERSECT - returns all distinct rows selected by both queries. MINUS - returns all distinct rows

    selected by the first query but not by the second. UNION - returns all distinct rows selected by eitherquery UNION ALL - returns all rows selected by either query, including all duplicates.

    What is ROWID?

    ROWID is a pseudo column attached to each row of a table. It is 18 characters long, blockno,rownumber are the components of ROWID.

    What is the fastest way of accessing a row in a table?

    Using ROWID.CONSTRAINTS

    What is an integrity constraint?Integrity constraint is a rule that restricts values to a column in a table.

    What is referential integrity constraint?

    Maintaining data integrity through a set of rules that restrict the values of one or more columns ofthe tables based on the values of primary key or unique key of the referenced table.

    What is the usage of SAVEPOINTS?

    SAVEPOINTS are used to subdivide a transaction into smaller parts. It enables rolling back part of atransaction. Maximum of five save points are allowed.

    What is ON DELETE CASCADE?When ON DELETE CASCADE is specified Oracle maintains referential integrity by automatically

    removing dependent foreign key values if a referenced primary or unique key value is removed.

  • 8/6/2019 Tech Interview Questions

    21/77

  • 8/6/2019 Tech Interview Questions

    22/77

    What are the advantages of VIEW?- To protect some of the columns of a table from other users.

    - To hide complexity of a query.- To hide complexity of calculations.

    Can a view be updated/inserted/deleted? If Yes - under what conditions?A View can be updated/deleted/inserted if it has only one base table if the view is based on columnsfrom one or more tables then insert, update and delete is not possible.

    If a view on a single base table is manipulated will the changes be reflected on the base table?

    If changes are made to the tables and these tables are the base tables of a view, then the changes willbe reference on the view.

    Which of the following statements is true about implicit cursors?1. Implicit cursors are used for SQL statements that are not named.

    2. Developers should use implicit cursors with great care.

    3. Implicit cursors are used in cursor for loops to handle data processing.4. Implicit cursors are no longer a feature in Oracle.

    Which of the following is not a feature of a cursor FOR loop?1. Record type declaration.

    2. Opening and parsing of SQL statements.3. Fetches records from cursor.

    4. Requires exit condition to be defined.

    A developer would like to use referential datatype declaration on a variable. The variable

    name is EMPLOYEE_LASTNAME, and the corresponding table and column is EMPLOYEE,

    and LNAME, respectively. How would the developer define this variable using referentialdatatypes?

    1. Use employee.lname%type.2. Use employee.lname%rowtype.

    3. Look up datatype for EMPLOYEE column on LASTNAME table and use that.4. Declare it to be type LONG.

    Which three of the following are implicit cursor attributes?1. %found

    2. %too_many_rows3. %notfound

    4. %rowcount5. %rowtype

    If left out, which of the following would cause an infinite loop to occur in a simple loop?

    1. LOOP2. END LOOP

    3. IF-THEN4. EXIT

  • 8/6/2019 Tech Interview Questions

    23/77

    Which line in the following statement will produce an error?1. cursor action_cursor is

    2. select name, rate, action3. into action_record

    4. from action_table;

    5. There are no errors in this statement.

    The command used to open a CURSOR FOR loop is

    1. open2. fetch

    3. parse4. None, cursor for loops handle cursor opening implicitly.

    What happens when rows are found using a FETCH statement

    1. It causes the cursor to close2. It causes the cursor to open

    3. It loads the current row values into variables4. It creates the variables to hold the current row values

    Under which circumstance must you recompile the package body after recompiling the

    package specification?

    1. Altering the argument list of one of the package constructs2. Any change made to one of the package constructs

    3. Any SQL statement change made to one of the package constructs4. Removing a local variable from the DECLARE section of one of the package constructs

    Procedure and Functions are explicitly executed. This is different from a database trigger.

    When is a database trigger executed?1. When the transaction is committed

    2. During the data manipulation statement3. When an Oracle supplied package references the trigger

    4. During a data manipulation statement and when the transaction is committed

    Which Oracle supplied package can you use to output values and messages from database

    triggers, stored procedures and functions within SQL*Plus?

    1. DBMS_DISPLAY2. DBMS_OUTPUT

    3. DBMS_LIST4. DBMS_DESCRIBE

    Examine this code71. BEGIN

    72. theater_pck.v_total_seats_sold_overall := theater_pck.get_total_for_year;73. END;

  • 8/6/2019 Tech Interview Questions

    24/77

    For this code to be successful, what must be true?1. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR

    function must exist only in the body of the THEATER_PCK package.2. Only the GET_TOTAL_FOR_YEAR variable must exist in the specification of the

    THEATER_PCK package.

    3. Only the V_TOTAL_SEATS_SOLD_OVERALL variable must exist in the specification of theTHEATER_PCK package.4. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR

    function must exist in the specification of the THEATER_PCK package.

    A stored function must return a value based on conditions that are determined at runtime.

    Therefore, the SELECT statement cannot be hard-coded and must be created dynamically

    when the function is executed. Which Oracle supplied package will enable this feature?1. DBMS_DDL

    2. DBMS_DML3. DBMS_SYN

    4. DBMS_SQL

    A stored function must return a value based on conditions that are determined at runtime.

    Therefore, the SELECT statement cannot be hard-coded and must be created dynamically

    when the function is executed. Which Oracle supplied package will enable this feature?1. DBMS_DDL

    2. DBMS_DML3. DBMS_SYN

    4. DBMS_SQL

    How to implement ISNUMERIC function in SQL *Plus ?

    Method 1:

    Select length (translate (trim (column_name),' +-.0123456789',' ')) from dual ;

    Will give you a zero if it is a number or greater than zero if not numeric (actually gives the count ofnon numeric characters)

    Method 2:

    select instr(translate('wwww',

    'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X')

    FROM dual;

    It returns 0 if it is a number, 1 if it is not.

    How to Select last N records from a Table?select * from (select rownum a, CLASS_CODE,CLASS_DESC from clm)

    where a > ( select (max(rownum)-10) from clm)

  • 8/6/2019 Tech Interview Questions

    25/77

    Here N = 10

    The following query has a Problem of performance in the execution of the following query where

    the table ter.ter_master have 22231 records. So the results are obtained after hours.

    Cursor rem_master(brepno VARCHAR2) ISselect a.* from ter.ter_master a

    where NOT a.repno in (select repno from ermast) and(brepno = 'ALL' or a.repno > brepno)

    Order by a.repno

    What are steps required tuning this query to improve its performance?-Have an index on TER_MASTER.REPNO and one on ERMAST.REPNO

    -Be sure to get familiar with EXPLAIN PLAN. This can help you determine the execution path that

    Oracle takes. If you are using Cost Based Optimizer mode, then be sure that your statistics onTER_MASTER are up-to-date. -Also, you can change your SQL to:

    SELECT a.*

    FROM ter.ter_master aWHERE NOT EXISTS (SELECT b.repno FROM ermast b

    WHERE a.repno=b.repno) AND(a.brepno = 'ALL' or a.repno > a.brepno)

    ORDER BY a.repno;

    What is the difference between Truncate and Delete interms of Referential Integrity?DELETE removes one or more records in a table, checking referential Constraints (to see if there are

    dependent child records) and firing any DELETE triggers. In the order you are deleting (child firstthen parent) There will be no problems.

    TRUNCATE removes ALL records in a table. It does not execute any triggers. Also, it only checksfor the existence (and status) of another foreign key Pointing to the table. If one exists and is

    enabled, then you will get The following error. This is true even if you do the child tables first.ORA-02266: unique/primary keys in table referenced by enabled foreign keys

    You should disable the foreign key constraints in the child tables before issuing the TRUNCATEcommand, then re-enable them afterwards.

    What does preemptive in preemptive multitasking mean ?Preemptive refers to the fact that each task is alloted fixed time slots and at the end of that time slot

    the next task is started.

    What does the OLTP stands for ?OLTP stands for On Line Transaction Processing

    What is the most important requirement for OLTP ?OLTP requires real time response.

  • 8/6/2019 Tech Interview Questions

    26/77

    In a client server environment, what would be the major work that the client deals with ?The client deals with the user interface part of the system.

    Why is the most of the processing done at the sever ?

    To reduce the network traffic and for application sharing and implementing business rules.

    What does teh term upsizing refer to ?Applications that have outgrown their environment are re-engineered to run in a larger environment.

    This is upsizing.

    What does one do when one is rightsizing ?

    With rightsizing, one would move applications to the most appropriate server platforms.

    What does the term downsizing refer to ?A host based application is re-engineered to run in smaller or LAN based environment.

    What is event trigger ?An event trigger, a segment of code which is associated with each event and is fired when the eventoccurs.

    Why do stored procedures reduce network traffic ?When a stored procedure is called, only the procedure call is sent to the server and not the statements

    that the procedure contains.

    What are the types of processes that a server runs ?Foreground process and Background process.

    What is a event handler ?An event handler is a routine that is written to respond to a particular event.

    What is an integrity constraint ?

    An integrity constraint allows the definition of certain restrictions, at the table level, on the data thatis entered into a table.

    What are the various uses of database triggers ?

    Database triggers can be used to enforce business rules, to maintain derived values and performvalue-based auditing.

    What is a transaction ?A transaction is a set of operations that begin when the first DML is issued and end when a commitor rollback is issued. BEGIN COMMIT/ROLLBACK are the boundries of a transaction.

    Why are the integrity constraints preferred to database triggers ?Because it is easier to define an integrity constraint than a database trigger.

  • 8/6/2019 Tech Interview Questions

    27/77

    Why is it better to use an integrity constraint to validate data in a table than to use a stored

    procedure ?

    Because an integrity constraint is automatically checked while data is inserted into a table. A storedhas to be specifically invoked.

    What are the three components of a client server model ?A Client,A Server and

    A Network/Communication software.

    What are the advantages of client/server model ?Flexibility of the system, scalability, cost saving, centralised control and implementation of business

    rules, increase of developers productivity, portability, improved network and resource utilization.

    What are the disadvantages of the client/server model ?

    Heterogeneity of the system results in reduced reliability. May not be suitable for all applications.

    Managing and tuning networks becomes difficult.

    What are the different topologies available for network ?

    Star,Bus,

    Ring.

    What is the first work of Client process ?A client process at first establishes connection with the Server.

    What are the responsibilities of a Server ?

    1. Manage resources optimally across multiple clients.2. Controlling database access and security.3. Protecting the database and recovering it from crashes.

    4. Enforcing integrity rules globally.

    In a Client/Server context, what does API (Application Programming Interface) refer to ?An API, in a Client/Server context, is a specification of a set of functions for communication

    between the client and the server.

    Give some examples of standard API??Open Database Connectivity (ODBC),

    Integrated Database Application Programming Interface (IDAPI),XOpen

    SQL/CLI

    What is the main advantage of developing an application using an API ?

    The application can be connected to any back end server that is supported by the API.

  • 8/6/2019 Tech Interview Questions

    28/77

    What is the main disadvantage of developing an application using an API ?The application cannot use any special features of the backend server.

    Why is an event driven program referred to a passive program ?

    Because an event driven program is always waiting for something to happen before processing.

    What are the four types of events ?1. System Events.

    2. Control Events3. User Events

    4. Other Events.

    What is the difference between file server and a database server ?

    A file server just transfers all the data requested by all its client and the client processes the datawhile a database server runs the query and sends only the query output.

    What is inheritance ?Inheritance is a method by which properties and methods of an existing object are automaticallypassed to any object derived from it.

    What are the two components of ODBC ?

    1. An ODBC manager/administrator and2. ODBC driver.

    What is the function of a ODBC manager ?The ODBC Manager manages all the data sources that exists in the system.

    What is the function of a ODBC Driver ?The ODBC Driver allows the developer to talk to the back end database.

    What description of a data source is required for ODBC ?The name of the DBMS, the location of the source and the database dependent information.

    How is a connection established by ODBC ?ODBC uses the description of the datasource available in the ODBC.INI file to load the required

    drivers to access that particular back end database.

    SQL/ SQL Plus

    1. How can variables be passed to a SQL routine?

    Level: LowExpected answer: By use of the & symbol. For passing in variables the numbers 1-8 can be used

    (&1, &2,...,&8) to pass the values after the command into the SQLPLUS session. To be promptedfor a specific variable, place the ampersanded variable in the code itself:

    "select * from dba_tables where owner=&owner_name;" . Use of double ampersands tells

  • 8/6/2019 Tech Interview Questions

    29/77

    SQLPLUS to resubstitute the value for each subsequent use of the variable, a single ampersand willcause a reprompt for the value unless an ACCEPT statement is used to get the value from the user.

    2. You want to include a carriage return/linefeed in your output from a SQL script, how can you do

    this?

    Level: Intermediate to highExpected answer: The best method is to use the CHR() function (CHR(10) is a return/linefeed) andthe concatenation function "||". Another method, although it is hard to document and isn?t always

    portable is to use the return/linefeed as a part of a quoted string.

    3. How can you call a PL/SQL procedure from SQL?Level: Intermediate

    Expected answer: By use of the EXECUTE (short form EXEC) command.

    4. How do you execute a host operating system command from within SQL?

    Level: Low

    Expected answer: By use of the exclamation point "!" (in UNIX and some other OS) or the HOST(HO) command.

    5. You want to use SQL to build SQL, what is this called and give an exampleLevel: Intermediate to high

    Expected answer: This is called dynamic SQL. An example would be:set lines 90 pages 0 termout off feedback off verify off

    spool drop_all.sqlselect ?drop user ?||username||? cascade;? from dba_users

    where username not in ("SYS?,?SYSTEM?);spool off

    Essentially you are looking to see that they know to include a command (in this case DROPUSER...CASCADE;) and that you need to concatenate using the ?||? the values selected from the

    database.

    6. What SQLPlus command is used to format output from a select?Level: low

    Expected answer: This is best done with the COLUMN command.

    7. You want to group the following set of select returns, what can you group on?

    Max(sum_of_cost), min(sum_of_cost), count(item_no), item_noLevel: Intermediate

    Expected answer: The only column that can be grouped on is the "item_no" column, the rest haveaggregate functions associated with them.

    8. What special Oracle feature allows you to specify how the cost based system treats a SQL

    statement?Level: Intermediate to high

    Expected answer: The COST based system allows the use of HINTs to control the optimizer path

  • 8/6/2019 Tech Interview Questions

    30/77

    selection. If they can give some example hints such as FIRST ROWS, ALL ROWS, USINGINDEX, STAR, even better.

    9. You want to determine the location of identical rows in a table before attempting to place a unique

    index on the table, how can this be done?

    Level: HighExpected answer: Oracle tables always have one guaranteed unique column, the rowid column. Ifyou use a min/max function against your rowid and then select against the proposed primary key you

    can squeeze out the rowids of the duplicate rows pretty quick. For example:select rowid from emp e

    where e.rowid > (select min(x.rowid)from emp x

    where x.emp_no = e.emp_no);In the situation where multiple columns make up the proposed key, they must all be used in the

    where clause.

    10. What is a Cartesian product?Level: Low

    Expected answer: A Cartesian product is the result of an unrestricted join of two or more tables. Theresult set of a three table Cartesian product will have x * y * z number of rows where x, y, z

    correspond to the number of rows in each table involved in the join.

    11. You are joining a local and a remote table, the network manager complains about the traffic

    involved, how can you reduce the network traffic?Level: High

    Expected answer: Push the processing of the remote data to the remote instance by using a view topre-select the information for the join. This will result in only the data required for the join being

    sent across.

    12. What is the default ordering of an ORDER BY clause in a SELECT statement?Level: Low

    Expected answer: Ascending

    13. What is tkprof and how is it used?Level: Intermediate to high

    Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQLstatements. You use it by first setting timed_statistics to true in the initialization file and then turning

    on tracing for either the entire database via the sql_trace parameter or for the session using theALTER SESSION command. Once the trace file is generated you run the tkprof tool against the

    trace file and then look at the output from the tkprof tool. This can also be used to generate explainplan output.

    14. What is explain plan and how is it used?Level: Intermediate to high

    Expected answer: The EXPLAIN PLAN command is a tool to tune SQL statements. To use it youmust have an explain_table generated in the user you are running the explain plan for. This is created

  • 8/6/2019 Tech Interview Questions

    31/77

    using the utlxplan.sql script. Once the explain plan table exists you run the explain plan commandgiving as its argument the SQL statement to be explained. The explain_plan table is then queried to

    see the execution plan of the statement. Explain plans can also be run using tkprof.

    15. How do you set the number of lines on a page of output? The width?

    Level: LowExpected answer: The SET command in SQLPLUS is used to control the number of lines generatedper page and the width of those lines, for example SET PAGESIZE 60 LINESIZE 80 will generate

    reports that are 60 lines long with a line width of 80 characters. The PAGESIZE and LINESIZEoptions can be shortened to PAGES and LINES.

    DATA STRUCTURES:

    Q1.What is data structure?

    A data structure is a way of organizing data that considers not only the items stored, but also their

    relationship to each other. Advance knowledge about the relationship between data items allowsdesigning of efficient algorithms for the manipulation of data.

    Q2.List out the areas in which data structures are applied extensively?

    Compiler Design,Operating System,Database Management System,

    Statistical analysis package,Numerical Analysis,

    Graphics,

    Artificial Intelligence,Simulatio

    Q3.What are the major data structures used in the following areas : RDBMS, Network data

    model & Hierarchical data model?

    RDBMS Array (i.e. Array of structures) Network data model Graph

    Hierarchical data model Tree

    Q4.If you are using C language to implement the heterogeneous linked list, what pointer typewill you use?

    The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to

    connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Voidpointer is capable of storing pointer to any type as it is a generic pointer type.

    Q5.Minimum number of queues needed to implement the priority queue?

  • 8/6/2019 Tech Interview Questions

    32/77

    Two. One queue is used for actual storing of data and another for storing priorities.

    Q6.What is the data structures used to perform recursion?

    Stack. Because of its LIFO (Last In First Out) property it remembers its caller so knows whom toreturn when the function has to return. Recursion makes use of system stack for storing the returnaddresses of the function calls.

    Every recursive function has its equivalent iterative (non-recursive) function. Even whensuch equivalent iterative procedures are written, explicit stack is to be used.

    Q7.What are the notations used in Evaluation of Arithmetic Expressions using prefix and

    postfix forms?

    Polish and Reverse Polish notations.

    Q8.Convert the expression ((A + B) * C (D E) ^ (F + G)) to equivalent Prefix and Postfix

    notations.

    Prefix Notation:^ - * +ABC - DE + FG

    Postfix Notation:AB + C * DE - - FG + ^

    Q9.Sorting is not possible by using which of the following methods?

    (a) Insertion

    (b) Selection(c) Exchange

    (d) Deletionans: (d) Deletion.

    Using insertion we can perform insertion sort, using selection we can perform selection sort, usingexchange we can perform the bubble sort (and other similar sorting methods). But no sorting method

    can be done just using deletion.

    Q10.What are the methods available in storing sequential files ?

    Straight merging,Natural merging,

    Polyphase sort,Distribution of Initial runs

    Q11.List out few of the Application of tree data-structure?

    The manipulation of Arithmetic expression,

  • 8/6/2019 Tech Interview Questions

    33/77

    Symbol Table construction,Syntax analysis.

    Q12.List out few of the applications that make use of Multilinked Structures?

    Sparse matrix,Index generation.

    Q13.In tree construction which is the suitable efficient data structure?

    (b) Linked list

    Q14.What is the type of the algorithm used in solving the 8 Queens problem?

    Backtracking

    Q15.In an AVL tree, at what condition the balancing is to be done?

    If the pivotal value (or the Height factor) is greater than 1 or less than 1.

    Q16.What is the bucket size, when the overlapping and collision occur at same time?

    One. If there is only one entry possible in the bucket, when the collision occurs, there is no way toaccommodate the colliding value. This results in the overlapping of

    Q17.Traverse the given tree using Inorder, Preorder and Postorder traversals.

    Inorder : D H B E A F C I G J

    Preorder: A B D H E C F G I JPostorder: H D E B F I J G C A

    Q18.There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have

    formed a full binary tree?

    In general:There are 2n-1 nodes in a full binary tree.

    By the method of elimination:Full binary trees contain odd number of nodes. So there cannot be full binary trees with 8 or 14

    nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree. Sothe correct answer is 15.

    Note:Full and Complete binary trees are different. All full binary trees are complete binary trees

    but not vice versa.

    Q19.Classify the Hashing Functions based on the various methods by which the key value is

    found.

  • 8/6/2019 Tech Interview Questions

    34/77

    Direct method,

    Subtraction method,Modulo-Division method,

    Digit-Extraction method,

    Mid-Square method,Folding method,Pseudo-random method.

    Q20.What are the types of Collision Resolution Techniques and the methods used in each of

    the type?

    1.Open addressing (closed hashing),

    The methods used include:Overflow block,

    2.Closed addressing (open hashing)

    The methods used include:Linked list,

    Binary tree

    Q21.In RDBMS, what is the efficient data structure used in the internal storage

    representation?

    B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier.This corresponds to the records that shall be stored in leaf nodes.

    Q22.Of the following tree structure, which is, efficient considering space and time

    complexities?

    (a) Incomplete Binary Tree(b) Complete Binary Tree

    (c) Full Binary Tree

    (b) Complete Binary Tree.

    By the method of elimination:Full binary tree loses its nature when operations of insertions and deletions are done. For incomplete

    binary trees, extra storage is required and overhead of NULL node checking takes place. Socomplete binary tree is the better one since the property of complete binary tree is maintained even

    after operations like additions and deletions are done on it.

  • 8/6/2019 Tech Interview Questions

    35/77

    Q23.What is a spanning Tree?

    A spanning tree is a tree associated with a network. All the nodes of the graph appear on the treeonce. A minimum spanning tree is a spanning tree organized so that the total edge weight between

    nodes is minimized.

    Q24.Does the minimum spanning tree of a graph give the shortest distance between any 2

    specified nodes?

    No.

    Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But itdoesnt mean that the distance between any two nodes involved in the minimum-spanning tree is

    minimum.

    Q25.Which is the simplest file structure?

    SequentialIndexed

    Random

    Ans : (a) Sequential

    Q26.Whether Linked List is linear or Non-linear data structure?

    According to Access strategies Linked list is a linear one.According to Storage Linked List is a Non-linear one.

    27.What is the data structures used to perform recursion?

    Stack. Because of its LIFO (Last In First Out) property it remembers its caller, so knowswhom to return when the function has to return. Recursion makes use of system stack for

    storing the return addresses of the function calls. Every recursive function has its equivalentiterative (non-recursive) function. Even when such equivalent iterative procedures are

    written, explicit stack is to be used.28.What are the methods available in storing sequential files ?

    Straight merging, Natural merging, Polyphase sort, Distribution of Initial runs.29.List out few of the Application of tree data-structure?

    The manipulation of Arithmetic expression, Symbol Table construction, Syntax analysis.30.In RDBMS, what is the efficient data structure used in the internal storage representation?

    B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searchingeasier. This corresponds to the records that shall be stored in leaf nodes.

    31.What is a spanning Tree?A spanning tree is a tree associated with a network. All the nodes of the graph appear on the

    tree once. A minimum spanning tree is a spanning tree organized so that the total edgeweight between nodes is minimized.

    32.Does the minimum spanning tree of a graph give the shortest distance between any 2specified nodes?

  • 8/6/2019 Tech Interview Questions

    36/77

    Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But itdoesn't mean that the distance between any two nodes involved in the minimum-spanning

    tree is minimum.33.Whether Linked List is linear or Non-linear data structure?

    According to Access strategies Linked list is a linear one. According to Storage Linked List

    is a Non-linear one.34.What is the quickest sorting method to use?The answer depends on what you mean by quickest. For most sorting problems, it just doesn't

    matter how quick the sort is because it is done infrequently or other operations takesignificantly more time anyway. Even in cases in which sorting speed is of the essence, there

    is no one answer. It depends on not only the size and nature of the data, but also the likelyorder. No algorithm is best in all cases. There are three sorting methods in this author's

    toolbox that are all very fast and that are useful in different situations. Those methods arequick sort, merge sort, and radix sort.

    The Quick Sort

    The quick sort algorithm is of the divide and conquer type. That means it works by reducinga sorting problem into several easier sorting problems and solving each of them. A dividing

    value is chosen from the input data, and the data is partitioned into three sets: elements thatbelong before the dividing value, the value itself, and elements that come after the dividing

    value. The partitioning is performed by exchanging elements that are in the first set butbelong in the third with elements that are in the third set but belong in the first Elements that

    are equal to the dividing element can be put in any of the three sets the algorithm will stillwork properly.

    The Merge Sort

    The merge sort is a divide and conquer sort as well. It works by considering the data to besorted as a sequence of already-sorted lists (in the worst case, each list is one element long).

    Adjacent sorted lists are merged into larger sorted lists until there is a single sorted listcontaining all the elements. The merge sort is good at sorting lists and other data structures

    that are not in arrays, and it can be used to sort things that don't fit into memory. It also canbe implemented as a stable sort.

    The Radix Sort

    The radix sort takes a list of integers and puts each element on a smaller list, depending onthe value of its least significant byte. Then the small lists are concatenated, and the process is

    repeated for each more significant byte until the list is sorted. The radix sort is simpler toimplement on fixed-length data such as ints.

    35.How can I search for data in a linked list?Unfortunately, the only way to search a linked list is with a linear search, because the only

    way a linked list's members can be accessed is sequentially. Sometimes it is quicker to takethe data from a linked list and store it in a different data structure so that searches can be

    more efficient.36.What is the heap?

    The heap is where malloc(), calloc(), and realloc() get memory.

  • 8/6/2019 Tech Interview Questions

    37/77

    Getting memory from the heap is much slower than getting it from the stack. On the otherhand, the heap is much more flexible than the stack. Memory can be allocated at any time

    and deallocated in any order. Such memory isn't deallocated automatically; you have to callfree().

    Recursive data structures are almost always implemented with memory from the heap.

    Strings often come from there too, especially strings that could be very long at runtime. Ifyou can keep data in a local variable (and allocate it from the stack), your code will run fasterthan if you put the data on the heap. Sometimes you can use a better algorithm if you use the

    heap faster, or more robust, or more flexible. Its a tradeoff.If memory is allocated from the heap, its available until the program ends. That's great if you

    remember to deallocate it when you're done. If you forget, it's a problem. A memory leak is

    some allocated memory that's no longer needed but isn't deallocated. If you have a memoryleak inside a loop, you can use up all the memory on the heap and not be able to get any

    more. (When that happens, the allocation functions return a null pointer.) In someenvironments, if a program doesn't deallocate everything it allocated, memory stays

    unavailable even after the program ends.

    37.

    What is the easiest sorting method to use?The answer is the standard library function qsort(). It's the easiest sort by far for severalreasons:

    It is already written.It is already debugged.

    It has been optimized as much as possible (usually).Void qsort(void *buf, size_t num, size_t size, int (*comp)(const void *ele1, const void

    *ele2));38.What is the bucket size, when the overlapping and collision occur at same time?

    One. If there is only one entry possible in the bucket, when the collision occurs, there is noway to accommodate the colliding value. This results in the overlapping of values.

    39.In an AVL tree, at what condition the balancing is to be done?If the pivotal value (or the Height factor) is greater than 1 or less than 1.

    40.Minimum number of queues needed to implement the priority queue?Two. One queue is used for actual storing of data and another for storing priorities.

    41.How many different trees are possible with 10 nodes ?1014 - For example, consider a tree with 3 nodes(n=3), it will have the maximum

    combination of 5 different (ie, 23 - 3 =? 5) trees.42.What is a node class?

    A node class is a class that, relies on the base class for services and implementation,provides a wider interface to users than its base class, relies primarily on virtual functions in

    its public interface depends on all its direct and indirect base class can be understood only inthe context of the base class can be used as base for further derivation

    can be used to create objects. A node class is a class that has added new services orfunctionality beyond the services inherited from its base class.

    43.When can you tell that a memory leak will occur?A memory leak occurs when a program loses the ability to free a block of dynamically

    allocated memory.44.What is placement new?

    When you want to call a constructor directly, you use the placement new. Sometimes you

  • 8/6/2019 Tech Interview Questions

    38/77

    have some raw memory thats already been allocated, and you need to construct an object inthe memory you have. Operator news special version placement new allows you to do it.

    class Widget{

    public :

    Widget(int widgetsize);Widget* Construct_widget_int_buffer(void *buffer,int widgetsize)

    {return new(buffer) Widget(widgetsize);

    }};

    This function returns a pointer to a Widget object thats constructed within the buffer passedto the function. Such a function might be useful for applications using shared memory or

    memory-mapped I/O, because objects in such applications must be placed at specificaddresses or in memory allocated by special routines.

    45.

    List out the areas in which data structures are applied extensively ?Compiler Design, Operating System, Database Management System, Statistical analysis

    package, Numerical Analysis, Graphics, Artificial Intelligence, Simulation46.If you are using C language to implement the heterogeneous linked list, what pointer type

    will you use?The heterogeneous linked list contains different data types in its nodes and we need a link,

    pointer to connect them. It is not possible to use ordinary pointers for this. So we go for voidpointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.

    47.What is the data structures used to perform recursion?Stack. Because of its LIFO (Last In First Out) property it remembers its caller so knows

    whom to return when the function has to return. Recursion makes use of system stack forstoring the return addresses of the function calls. Every recursive function has its equivalent

    iterative (non-recursive) function. Even when such equivalent iterative procedures arewritten, explicit stack is to be used.

    48.Whether Linked List is linear or Non-linear data structure?According to Access strategies Linked list is a linear one.

    According to Storage Linked List is a Non-linear one

    49.Tell how to check whether a linked list is circular ?Create two pointers, each set to the start of the list. Update each as follows:

    while (pointer1)

    {

    pointer1 = pointer1->next;pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;

    if (pointer1 == pointer2)

    ? ? ? ? ? ? {print (\circular\n\);

  • 8/6/2019 Tech Interview Questions

    39/77

    }}

    50.What is the difference between ARRAY and STACK?STACK follows LIFO. Thus the item that is first entered would be the last removed.

    In array the items can be entered or removed in any order. Basically each member access isdone using index. No strict order is to be followed here to remove a particular element.51.What is the difference between NULL AND VOID pointer?

    NULL can be value for pointer type variables.VOID is a type identifier which has not size.

    NULL and void are not same. Example: void* ptr = NULL;52.What is precision?

    Precision refers the accuracy of the decimal portion of a value. Precision is the number ofdigits allowed after the decimal point.

    53.What is impact of signed numbers on the memory?Sign of the number is the first bit of the storage allocated for that number. So you get one bit

    less for storing the number. For example if you are storing an 8-bit number, without sign, therange is 0-255. If you decide to store sign you get 7 bits for the number plus one bit for the

    sign. So the range is -128 to +127.54.How memory is reserved using a declaration statement ?

    Memory is reserved using data type in the variable declaration. A programming languageimplementation has predefined sizes for its data types.

    For example, in C# the declaration int i; will reserve 32 bits for variable i.

    A pointer declaration reserves memory for the address or the pointer variable, but not for the

    data that it will point to. The memory for the data pointed by a pointer has to be allocated atruntime.

    The memory reserved by the compiler for simple variables and for storing pointer address is

    allocated on the stack, while the memory allocated for pointer referenced data at runtime isallocated on the heap.

    55.How many parts are there in a declaration statement?There are two main parts, variable identifier and data type and the third type is optional

    which is type qualifier like signed/unsigned.56.Is Pointer a variable?

    Yes, a pointer is a variable and can be used as an element of a structure and as an attribute ofa class in some programming languages such as C++, but not Java. However, the contents of

    a pointer is a memory address of another location of memory, which is usually the memoryaddress of another variable, element of a structure, or attribute of a class.

    57.What is Data Structure?A data structure is a group of data elements grouped together under one name. These data

    elements, known as members, can have different types and different lengths. Some are usedto store the data of same type and some are used to store different types of data.

    58.What is significance of * ?The symbol * tells the computer that you are declaring a pointer.

  • 8/6/2019 Tech Interview Questions

    40/77

    Actually it depends on context.In a statement like int *ptr; the * tells that you are declaring a pointer.

    In a statement like int i = *ptr; it tells that you want to assign value pointed to by ptr tovariable i.

    The symbol * is also called as Indirection Operator/ Dereferencing Operator.59.Why do we Use a Multidimensional Array?A multidimensional array can be useful to organize subgroups of data within an array. In

    addition to organizing data stored in elements of an array, a multidimensional array can storememory addresses of data in a pointer array and an array of pointers.

    Multidimensional arrays are used to store information in a matrix form.

    e.g. a railway timetable, schedule cannot be stored as a single dimensional array.One can use a 3-D array for storing height, width and length of each room on each floor of a

    building.60.How do you assign an address to an element of a pointer array ?

    We can assign a memory address to an element of a pointer array by using the addressoperator, which is the ampersand (&), in an assignment statement such as ptemployee[0] =

    &projects[2];61.Run Time Memory Allocation is known as ?

    Allocating memory at runtime is called a dynamically allocating memory. In this, youdynamically allocate memory by using the new operator when declaring the array, for

    example : int grades[] = new int[10];62.What method is used to place a value onto the top of a stack?

    push() method, Push is the direction that data is being added to the stack. push() membermethod places a value onto the top of a stack.

    63.What method removes the value from the top of a stack?The pop() member method removes the value from the top of a stack, which is then returned

    by the pop() member method to the statement that calls the pop() member method.64.What does isEmpty() member method determines?

    isEmpty() checks if the stack has at least one element. This method is called by Pop() beforeretrieving and returning the top element.

    65.What is a queue ?A Queue is a sequential organization of data. A queue is a first in first out type of data

    structure. An element is inserted at the last position and an element is always taken out fromthe first position.

    66.What is the relationship between a queue and its underlying array?Data stored in a queue is actually stored in an array. Two indexes, front and end will be used

    to identify the start and end of the queue.

    When an element is removed front will be incremented by 1. In case it reaches past the lastindex available it will be reset to 0. Then it will be checked with end. If it is greater than end

    queue is empty.

    When an element is added end will be incremented by 1. In case it reaches past the last index

  • 8/6/2019 Tech Interview Questions

    41/77

    available it will be reset to 0. After incrementing it will be checked with front. If they areequal queue is full.

    67.Which process places data at the back of the queue?Enqueue is the process that places data at the back of the queue.

    68.Why is the isEmpty() member method called?

    The isEmpty() member method is called within the dequeue process to determine if there isan item in the queue to be removed i.e. isEmpty() is called to decide whether the queue has atleast one element. This method is called by the dequeue() method before returning the front

    element.69.How is the front of the queue calculated ?

    The front of the queue is calculated by front = (front+1) % size.70.What does each entry in the Link List called?

    Each entry in a linked list is called a node. Think of a node as an entry that has three subentries. One sub entry contains the data, which may be one attribute or many attributes.

    Another points to the previous node, and the last points to the next node. When you enter anew item on a linked list, you allocate the new node and then set the pointers to previous and

    next nodes.71.What is Linked List ?

    Linked List is one of the fundamental data structures. It consists of a sequence of? nodes,each containing arbitrary data fields and one or two (links) pointing to the next and/or

    previous nodes. A linked list is a self-referential datatype because it contains a pointer or linkto another data of the same type. Linked lists permit insertion and removal of nodes at any

    point in the list in constant time, but do not allow random access.72.What member function places a new node at the end of the linked list?

    The appendNode() member function places a new node at the end of the linked list. TheappendNode() requires an integer representing the current data of the node.

    73.How is any Data Structure application is classified among files?A linked list application can be organized into a header file, source file and main application

    file. The first file is the header file that contains the definition of the NODE structure and theLinkedList class definition. The second file is a source code file containing the

    implementation of member functions of the LinkedList class. The last file is the applicationfile that contains code that creates and uses the LinkedList class.

    74.Which file contains the definition of member functions?Definitions of member functions for the Linked List class are contained in the LinkedList.cpp

    file.75.What are the major data structures used in the following areas : RDBMS, Network data

    model & Hierarchical data model.1. RDBMS Array (i.e. Array of structures)

    2. Network data model Graph3. Hierarchical data model Trees.

    76.Difference between calloc and malloc ?malloc: allocate n bytes

    calloc: allocate m times n bytes initialized to 0

    COMPUTER NETWORKS:

  • 8/6/2019 Tech Interview Questions

    42/77

    What is an Object server?With an object server, the Client/Server application is written as a set of communicating objects.

    Client object communicate with server objects using an Object Request Broker (ORB). The clientinvokes a method on a remote object. The ORB locates an instance of that object server class,

    invokes the requested method and returns the results to the client object. Server objects must provide

    support for concurrency and sharing. The ORB brings it all together.

    What is a Transaction server?

    With a transaction server, the client invokes remote procedures that reside on the server with an SQLdatabase engine. These remote procedures on the server execute a group of SQL statements. The

    network exchange consists of a single request/reply message. The SQL statements either all succeedor fail as a unit.

    What is a Database Server?

    With a database server, the client passes SQL requests as messages to the database server. Theresults of each SQL command are returned over the network. The server uses its own processing

    power to find the request data instead of passing all the records back to the client and then getting itfind its own data. The result is a much more efficient use of distributed processing power. It is also

    known as SQL engine.

    What are the most typical functional units of the Client/Server applications?

    User interfaceBusiness Logic and

    Shared data.

    What are all the Extended services provided by the OS?

    Ubiquitous communications

    Network OS extensionBinary large objects (BLOBs)

    Global directories and Network yellow pagesAuthentication and Authorization services

    System managementNetwork time

    Database and transaction servicesInternet services

    Object- oriented services

    What are Triggers and Rules?Triggers are special user defined actions usually in the form of stored procedures, that are

    automatically invoked by the server based on data related events. It can perform complex actions andcan use the full power of procedural languages.

    A rule is a special type of trigger that is used to perform simple checks on data.

  • 8/6/2019 Tech Interview Questions

    43/77

    What is meant by Transparency?Transparency really means hiding the network and its servers from the users and even the

    application programmers.

    What are TP-Lite and TP-Heavy Monitors?

    TP-Lite is simply the integration of TP Monitor functions in the database engines. TP-Heavy are TPMonitors which supports the Client/Server architecture and allow PC to initiate some very complexmultiserver transaction from the desktop.

    What are the two types of OLTP?

    TP lite, based on stored procedures. TP heavy, based on the TP monitors.

    What is a Web server?

    This new model of Client/Server consists of thin, protable, "universal" clients that talk to superfatservers. In the simplet form, a web server returns documents when clients ask for them by name. The

    clients and server communicate using an RPC-like protocol called HTTP.

    What are Super servers?These are fully-loaded machines which includes multiprocessors, high-speed disk arrays for

    intervive I/O and fault tolerant features.

    What is a TP Monitor?There is no commonly accepted definition for a TP monitor. According to Jeri Edwards' a TP

    Monitor is "an OS for transaction processing".

    TP Monitor does mainly two things extremely well. They are Process management and

    Transaction management.?

    They were originally introduced to run classes of applications that could service hundreds andsometimes thousands of clients. TP Monitors provide an OS - on top of existing OS - that connectsin real time these thousands of humans with a pool of shared server processes.

    What is meant by Asymmetrical protocols?

    There is a many-to-one relationship between clients and server. Clients always initiate the dialog byrequesting a service. Servers are passively awaiting for requests from clients.

    What are the types of Transparencies?

    The types of transparencies the NOS middleware is expected to provide are:-Location transparency

    Namespace transparencyLogon transparency

    Replication transparencyLocal/Remote access transparency

    Distributed time transparencyFailure transparency andAdministration transparency.

  • 8/6/2019 Tech Interview Questions

    44/77

    What is the difference between trigger and rule?The triggers are called implicitly by database generated events, while stored procedures are called

    explicitly by client applications.

    What are called Transactions?

    The grouped SQL statements are called Transactions (or) A transaction is a collection of actionsembused with ACID properties.

    What are the building blocks of Client/Server?The client

    The server andMiddleware.

    Explain the building blocks of Client/Server?The client side building block runs the client side of the application.

    The server side building block runs the server side of the application.

    The middleware buliding block runs on both the client and server sides of an application. It is

    broken into three categories:-

    Transport stackNetwork OS

    Service-specific middleware.

    What are all the Base services provided by the OS?

    Task preemptionTask prioritySemaphores

    Interprocess communications (IPC)Local/Remote Interprocess communication

    ThreadsIntertask protection

    MultiuserHigh performance file system

    Efficient memory management andDynamically linked Run-time extensions.

    What are the roles of SQL?

    SQL is an interactive query language for ad hoc database queries.SQL is a database programming language.

    SQL is a data definition and data administration language.SQL is the language of networked database serversSQL helps protect the data in a multi-user networked environment.

  • 8/6/2019 Tech Interview Questions

    45/77

    Because of these multifacted roles it plays, physicists might call SQL as "The grand unified theoryof database".

    What are the characteristics of Client/Server?

    Service

    Shared resourcesAsymmentrical protocolsTransparency of location

    Mix-and-matchMessage based exchanges

    Encapsulation of servicesScalability

    IntegrityClient/Server computing is the ultimate "Open platform". It gives the freedom to mix-and-match

    components of almost any level. Clients and servers are loosely coupled systems that interactthrough a message-passing mechanism.

    What is Structured Query Langauge (SQL)?

    SQL is a powerful set-oriented language which was developed by IBM research for the databasesthat adhere to the relational model. It consists of a short list of powerful, yet highly flexible,

    commands that can be used to manipulate information collected in tables. Through SQL, we canmanipulate and control sets of records at a time.

    What is Remote Procedure Call (RPC)?RPC hides the intricacies of the network by using the ordinary procedure call mechanism familiar to

    every programmer. A client process calls a function on a remote server and suspends itself until itgets back the results. Parameters are passed like in any ordinary procedure. The RPC, like an

    ordinary procedure, is synchoronous. The process that issues the call waits until it gets the results.Under the covers, the RPC run-time software collects values for the parameters, forms a message,

    and sends it to the remote server. The server receives the request, unpack the parameters, calls theprocedures, and sends the reply back to the client. It is a telephone-like metaphor.

    What are the main components of Transaction-based Systems?

    Resource ManagerTransaction Manager and

    Application Program.

    What are the three types of SQL database server architecture?Process-per-client Architecture. (Example: Oracle 6, Informix )

    Multithreaded Architecture. (Example: Sybase, SQL server)Hybrid Architecture

    What are the Classification of clients?Non-GUI clients - Two types are:-

    Non-GUI clients that do not need multi-tasking(Example: Automatic Teller Machines (ATM), Cell phone)

  • 8/6/2019 Tech Interview Questions

    46/77

    Non-GUI clients that need multi-tasking(Example: ROBOTs)

    GUI clients

    OOUI clients

    What are called Non-GUI clients, GUI Clients and OOUI Clients?Non-GUI Client: These are applications, generate server requests with a minimal amount of human

    interaction.GUI Clients: These are applicatoins, where occassional requests to the server result from a human

    interacting with a GUI(Example: Windows 3.x, NT 3.5)

    OOUI clients : These are applications, which are highly-iconic, object-oriented user interface thatprovides seamless access to information in very visual formats.

    (Example: MAC OS, Windows 95, NT 4.0)

    What is Message Oriented Middleware (MOM)?MOM allows general purpose messages to be exchanged in a Client/Server system using message

    queues. Applications communicate over networks by simply putting messages in the queues andgetting messages from queues. It typically provides a very simple high level APIs to its services.

    MOM's messaging and queuing allow clients and servers to communicate across a network withoutbeing linked by a private, dedicated, logical connection. The clients and server can run at different

    times. It is a post-office like metaphor.

    What is meant by Middleware?

    Middleware is a distributed software needed to support interaction between clients and servers. Inshort, it is the software that is in the middle of the Client/Server systems and it acts as a bridge

    between the clients and servers. It starts with the API set on the client side that is used to invoke aservice and it covers the transmission of the request over the network and the resulting response.

    It neither includes the software that provides the actual service - that is in the servers domain nor theuser interface or the application login - that's in clients domain.

    What are the functions of the typical server program?

    It waits for client-initiated requests. Executes many requests at the same time. Takes care of VIPclients first. Initiates and runs background task activity. Keeps running. Grown bigger and faster.

    What is meant by Symmentric Multiprocessing (SMP)?

    It treats all processors as equal. Any processor can do the work of any other processor. Applicationsare divided into threads that can run concurrently on any available processor. Any processor in the

    pool can run the OS kernel and execute user-written threads.

    What are General Middleware?

    It includes the communication stacks, distributed directories, authentication services, network time,RPC, Queuing services along with the network OS extensions such as the distributed file and print

    services.

  • 8/6/2019 Tech Interview Questions

    47/77

    What are Service-specific middleware?It is needed to accomplish a particular Client/Server type of services which includes:-

    Database specific middlewareOLTP specific middleware

    Groupware specific middleware

    Object specific middlewareInternet specific middleware andSystem management specific middleware.

    What is meant by Asymmetric Multiprocessing (AMP)?

    It imposses hierarchy and a division of labour among processors. Only one designated processor, themaster, controls (in a tightly coupled arrangement) slave processors dedicated to specific functions.

    What is OLTP?

    In the transaction server, the client component usually includes GUI and the server componentsusually consists of SQL transactions against a database. These applications are called OLTP (Online

    Transaction Processing) OLTP Applications typically,Receive a fixed set of inputs from remote clients. Perform multiple pre-compiled SQL comments

    against a local database. Commit the work and Return a fixed set of results.

    What is meant by 3-Tier architecture?

    In 3-tier Client/Server systems, the application logic (or process) lives in the middle tier and it isseparated from the data and the user interface. In theory, the 3-tier Client/Server systems are more

    scalable, robust and flexible.Example: TP monitor, Web.


Recommended