Correlated subquery runs once for each row selected by the outer query. It contains a reference
to a value from the row selected by the outer query.
For example,
Nested subquery runs only once for the entire nesting (outer) query. It does not contain any
reference to the outer query row.
For example,
select empname, basicsal, deptno from emp where (deptno, basicsal) in (select deptno,
max(basicsal) from emp group by deptno)
No comments: Links to this post
Labels: .NET 3.0 Tutorial, Database
Clustered Index:- A Clustered index is a special type of index that reorders the way records in
the table are physically stored. Therefore table may have only one clustered index.
Non-Clustered Index:- A Non-Clustered index is a special type of index in which the logical
order of the index does not match the physical stored order of the rows in the disk. The leaf
nodes of a non-clustered index does not consists of the data pages. instead the leaf node contains
index rows.
No comments: Links to this post
Labels: Database
RDBMS have Normalization. Normalization means to refining the redundant and maintain the
stablization.
the DBMS hasn't normalization concept.
Another reason of using triggers can be for automatic updation of one or more tables
whenever a DML/DDL statement is executed for the table on which the trigger is created.
Triggers can be used to enforce constraints. For eg : Any insert/update/ Delete statements
should not be allowed on a particular table after office hours. For enforcing this constraint
Triggers should be used.
We cant create an Index on Index.. Index is stored in user_index table.Every object that has been
created on Schema is Schema Object like Table,View etc.If we want to share the particular data
to various users we have to use the virtual table for the Base table...So that is a view.
indexing is used for faster search or to retrieve data faster from various table. Schema containing
set of tables, basically schema means logical separation of the database. View is crated for faster
retrieval of data. It's customized virtual table. we can create a single view of multiple tables.
Only the drawback is..view needs to be get refreshed for retrieving updated data.
but trigger is automatically invoked when the action defined in trigger is done.
ex: create trigger after Insert on
Triggers are used to initiate a particular activity after fulfilling certain condition.It need to
define and can be enable and disable according to need.
No comments: Links to this post
Labels: Database
This document provides guidelines to install Oracle 10g database on Microsoft Windows
environment. If you use other operating system other than Microsoft Windows, the process is not
too much different from that of Microsoft Windows, since Oracle uses Oracle Universal Installer
to install its software.
For more information about installing Oracle 10g under operating systems other than Microsoft
Windows, please refer to this URL :
http://www.oracle.com/pls/db102/homepage
You can download Oracle 10g database from www.oracle.com. You must registered and create
an account before you can download the software. The example in this document uses Oracle
Database 10g Release 2 (10.2.0.1.0) for Microsoft Windows.
Uninstall all Oracle components using the Oracle Universal Installer (OUI).
Run regedit.exe and delete the HKEY_LOCAL_MACHINE/ SOFTWARE/ORACLE key. This
contains registry entire for all Oracle products.
Delete any references to Oracle services left behind in the following part of the registry: HKEY
LOCAL MACHINE/ SYSTEM/ CurrentControlsSet/ Services/Ora*. It should be pretty obvious
which ones relate to Oracle
Reboot your machine.
Delete the C: \Oracle directory, or whatever directory is your Oracle_Base.
Delete the C:\Program Files \Oracle directory.
Empty the contents of your c:\temp directory.
Empty your recycle bin.
No comments: Links to this post
Labels: Database
What is the purpose of the product order option in the column property sheet?
To specify the order of individual group evaluation in a cross products.
What is a timer?
Timer is an "internal time clock" that you can programmatically create to perform an action each
time the times.
What is term?
The term is terminal definition file that describes the terminal form which you are using r20run.
What are the default extensions of the files created by library module?
The default file extensions indicate the library module type and storage format .pll - pl/sql library
module binary
What are the built-ins that are used to Attach an LOV programmatically to an item?
set_item_property
get_item_property
(by setting the LOV_NAME property)
What are the different file extensions that are created by oracle reports?
Rep file and Rdf file.
How does one put a database into ARCHIVELOG mode? (for DBA )
The main reason for running in archivelog mode is that one can provide 24-hour availability and
guarantee complete data recoverability. It is also necessary to enable ARCHIVELOG mode
before one can start to use on-line database backups. To enable ARCHIVELOG mode, simply
change your database startup command script, and bounce the database:
SQLPLUS> connect sys as sysdba
SQLPLUS> startup mount exclusive;
SQLPLUS> alter database archivelog;
SQLPLUS> archive log start;
SQLPLUS> alter database open;
NOTE1: Remember to take a baseline database backup right after enabling archivelog mode.
Without it one would not be able to recover. Also, implement an archivelog backup to prevent
the archive log directory from filling-up.
NOTE2: ARCHIVELOG mode was introduced with Oracle V6, and is essential for database
point-in-time recovery. Archiving can be used in combination with on-line and off-line database
backups.
NOTE3: You may want to set the following INIT.ORA parameters when enabling
ARCHIVELOG mode: log_archive_start=TRUE, log_archive_dest=... and
log_archive_format=...
NOTE4: You can change the archive log destination of a database on-line with the ARCHIVE
LOG START TO 'directory'; statement. This statement is often used to switch archiving between
a set of directories.
NOTE5: When running Oracle Real Application Server (RAC), you need to shut down all nodes
before changing the database to ARCHIVELOG mode.
What is the basic data structure that is required for creating an LOV?
Record Group.
Does Oracle write to data files in begin/hot backup mode? (for DBA )
Oracle will stop updating file headers, but will continue to write data to the database files even if
a tablespace is in backup mode.
In backup mode, Oracle will write out complete changed blocks to the redo log files. Normally
only deltas (changes) are logged to the redo logs. This is done to enable reconstruction of a block
if only half of it was backed up (split blocks). Because of this, one should notice increased log
activity and archiving during on-line backups.
No comments: Links to this post
Labels: Database, Oracle
What are the factors causing the reparsing of SQL statements in SGA?
Due to insufficient shared pool size.
Monitor the ratio of the reloads takes place while executing SQL statements. If the ratio is
greater than 1 then increase the SHARED_POOL_SIZE.
If a parameter is used in a query without being previously defined, what diff. exist between.
report 2.0 and 2.5 when the query is applied?
While both reports 2.0 and 2.5 create the parameter, report 2.5 gives a message that a bind
parameter has been created.
What are the sql clauses supported in the link property sheet?
Where start with having.
What is the "LOV of Validation" Property of an item? What is the use of it?
When LOV for Validation is set to True, Oracle Forms compares the current value of the text
item to the values in the first column displayed in the LOV. Whenever the validation event
occurs. If the value in the text item matches one of the values in the first column of the LOV,
validation succeeds, the LOV is not displayed, and processing continues normally. If the value in
the text item does not match one of the values in the first column of the LOV, Oracle Forms
displays the LOV and uses the text item value as the search criteria to automatically reduce the
list.
What is the diff. when Flex mode is mode on and when it is off?
When flex mode is on, reports automatically resizes the parent when the child is resized.
What are the two types of views available in the object navigator(specific to report 2.5)?
View by structure and view by type .
If two groups are not linked in the data model editor, What is the hierarchy between them?
Two group that is above are the left most rank higher than the group that is to right or below it.
No comments: Links to this post
Labels: Database, Oracle
What is a profile ?
Each database user is assigned a Profile that specifies limitations on various system resources
available to the user.
How can one see who is using a temporary segment? (for DBA )
For every user using temporary space, there is an entry in SYS.V$_LOCK with type 'TS'.
All temporary segments are named 'ffff.bbbb' where 'ffff' is the file it is in and 'bbbb' is first block
of the segment. If your temporary tablespace is set to TEMPORARY, all sorts are done in one
large temporary segment. For usage stats, see SYS.V_$SORT_SEGMENT
From Oracle 8.0, one can just query SYS.v$sort_usage. Look at these examples:
select s.username, u."USER", u.tablespace, u.contents, u.extents, u.blocks
from sys.v_$session s, sys.v_$sort_usage u
where s.addr = u.session_addr
/
select s.osuser, s.process, s.username, s.serial#,
Sum (u.blocks)*vp.value/1024 sort_size
from sys.v_$session s, sys.v_$sort_usage u, sys.v_$parameter VP
where s.saddr = u.session_addr
and vp.name = 'db_block_size'
and s.osuser like '&1'
group by s.osuser, s.process, s.username, s.serial#, vp.value
/
How can we specify the Archived log file name format and destination?
By setting the following values in init.ora file. LOG_ARCHIVE_FORMAT = arch %S/s/T/tarc
(%S - Log sequence number and is zero left paded, %s - Log sequence number not padded. %T -
Thread number lef-zero-paded and %t - Thread number not padded). The file name created is
arch 0001 are if %S is used. LOG_ARCHIVE_DEST = path.
What is a SNAPSHOT ?
Snapshots are read-only copies of a master table located on a remote node which is periodically
refreshed to reflect changes made to the master table.
What is snapshots?
Snapshot is an object used to dynamically replicate data between distribute database at specified
time intervals. In ver 7.0 they are read only.
What are the various type of snapshots?
Simple and Complex.
Can you have more than one content canvas view attached with a window?
Yes. Each window you create must have atleast one content canvas view assigned to it. You can
also create a window that has manipulated content canvas view. At run time only one of the
content canvas views assign to a window is displayed at a time.
Does a Before form trigger fire when the parameter form is suppressed?
Yes.
No comments: Links to this post
Labels: Database, Oracle, SQL Server
What is a Schema ?
The set of objects owned by user account is called the schema.
What is a cluster Key ?
The related columns of the tables are called the cluster key. The cluster key is indexed using a
cluster index and its value is stored only once for multiple tables in the cluster.
What is clusters ?
Group of tables physically stored together because they share common columns and are often
used together is called Cluster.
What are the system resources that can be controlled through Profile ?
The number of concurrent sessions the user can establish the CPU processing time available to
the user's session the CPU processing time available to a single call to ORACLE made by a SQL
statement the amount of logical I/O available to the user's session the amout of logical I/O
available to a single call to ORACLE made by a SQL statement the allowed amount of idle time
for the user's session the allowed amount of connect time for the user's session.
What is Auditing ?
Monitoring of user access to aid in the investigation of database use.
No comments: Links to this post
Labels: Database, Oracle, SQL Server
Oracle Interview Questions And Answers [3]
What is a synonym?
A synonym is an alias for a table, view, sequence or program unit.
What is a Tablespace?
A database is divided into Logical Storage Unit called tablespace. A tablespace is used to
grouped related logical structures together
What is Rollback Segment ?
A Database contains one or more Rollback Segments to temporarily store "undo" information.
What is the effect of setting the value "ALL_ROWS" for OPTIMIZER_GOAL parameter of the
ALTER SESSION command ? What are the factors that affect OPTIMIZER in choosing an
Optimization approach ?
Answer The OPTIMIZER_MODE initialization parameter Statistics in the Data Dictionary the
OPTIMIZER_GOAL parameter of the ALTER SESSION command hints in the statement.
What is the effect of setting the value "CHOOSE" for OPTIMIZER_GOAL, parameter of the
ALTER SESSION Command ?
The Optimizer chooses Cost_based approach and optimizes with the goal of best throughput if
statistics for atleast one of the tables accessed by the SQL statement exist in the data dictionary.
Otherwise the OPTIMIZER chooses RULE_based approach.
What are the different approaches used by Optimizer in choosing an execution plan ?
Rule-based and Cost-based.
Use the same extent size for all the segments in a given tablespace. Locally Managed tablespaces
(available from 8i onwards) with uniform extent sizes virtually eliminates any tablespace
fragmentation. Note that the number of extents per segment does not cause any performance
issue anymore, unless they run into thousands and thousands where additional I/O may be
required to fetch the additional blocks where extent maps of the segment are stored.
Where can one find the high water mark for a table? (for DBA)
There is no single system table, which contains the high water mark (HWM) for a table. A table's
HWM can be calculated using the results from the following SQL statements:
SELECT BLOCKS
FROM DBA_SEGMENTS
WHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);
ANALYZE TABLE owner.table ESTIMATE STATISTICS;
SELECT EMPTY_BLOCKS
FROM DBA_TABLES
WHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);
Thus, the tables' HWM = (query result 1) - (query result 2) - 1
NOTE: You can also use the DBMS_SPACE package and calculate the HWM =
TOTAL_BLOCKS - UNUSED_BLOCKS - 1.
What is a tablespace?
A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to
grouped related logical structures together.
What is schema?
A schema is collection of database objects of a user.
Yes.
What are the Referential actions supported by FOREIGN KEY integrity constraint ?
UPDATE and DELETE Restrict - A referential integrity rule that disallows the update or deletion
of referenced data. DELETE Cascade - When a referenced row is deleted all associated
dependent rows are deleted.
What is an Index ?
An Index is an optional structure associated with a table to have direct access to rows, which can
be created to increase the performance of data retrieval. Index can be created on one or more
columns of a table.
What is an Extent ?
An Extent is a specific number of contiguous data blocks, obtained in a single allocation, and
used to store a specific type of information.
What is a View ?
A view is a virtual table. Every view has a Query attached to it. (The Query is a SELECT
statement that identifies the columns and rows of the table(s) the view uses.)
What is Table ?
A table is the basic unit of data storage in an ORACLE database. The tables of a database hold
all of the user accessible data. Table data is stored in rows and columns.
No comments: Links to this post
Labels: Database, Oracle
What is Auditing ?
The database has the ability to audit all actions that take place within it.
a) Login attempts, b) Object Accesss, c) Database Action Result of Greatest(1,NULL) or
Least(1,NULL) NULL
Error
Can database trigger written on synonym of a table and if it can be then what would be the effect
if original table is accessed.
Yes, database trigger would fire.
What is the effect of synonym and table name used in same Select statement ?
Valid
If any other table same as dual is created would it act similar to dual?
Yes
Assume that there are multiple databases running on one machine. How can you switch from one
to another ?
Changing the ORACLE_SID
What all important parameters of the init.ora are supposed to be increased if you want to increase
the SGA size ?
In our case, db_block_buffers was changed from 60 to 1000 (std values are 60, 550 & 3500)
shared_pool_size was changed from 3.5MB to 9MB (std values are 3.5, 5 & 9MB) open_cursors
was changed from 200 to 300 (std values are 200 & 300) db_block_size was changed from 2048
(2K) to 4096 (4K) {at the time of database creation}.
The initial SGA was around 4MB when the server RAM was 32MB and The new SGA was
around 13MB when the server RAM was increased to 128MB.
If I have an execute privilege on a procedure in another users schema, can I execute his
procedure even though I do not have privileges on the tables within the procedure ?
Yes
If you insert a row in a table, then create another table and then say Rollback. In this case will the
row be inserted ?
Yes. Because Create table is a DDL which commits automatically as soon as it is executed. The
DDL commits the transaction even if the create statement fails internally (eg table already exists
error) and not syntactically.
Which of the following is not a schema object : Indexes, tables, public synonyms, triggers and
packages ?
Public synonyms
What is PL/SQL?
PL/SQL is Oracle's Procedural Language extension to SQL. The language includes object
oriented programming techniques such as encapsulation, function overloading, information
hiding (all but inheritance), and so, brings state-of-the-art programming to the Oracle database
server and a variety of Oracle tools.
Can one use dynamic SQL within PL/SQL? OR Can you use a DDL in a procedure ? How ?
From PL/SQL V2.1 one can use the DBMS_SQL package to execute dynamic SQL statements.
Eg: CREATE OR REPLACE PROCEDURE DYNSQL
AS
cur integer;
rc integer;
BEGIN
cur := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(cur,'CREATE TABLE X (Y DATE)', DBMS_SQL.NATIVE);
rc := DBMS_SQL.EXECUTE(cur);
DBMS_SQL.CLOSE_CURSOR(cur);
END;
No comments: Links to this post
Labels: Database, Oracle
Integration Services/DTS
Database Optimization
A) 16
B) 32
C) 256
D) 1024
Question 2
When using BCP to copy data into a table, which of the following statements apply?
Choose 2.
A) Database users will not be able to access the table because BCP will lock it.
B) Database users will see the rows inserted by BCP after each batch is complete.
C) You must have INSERT permissions on the table.
D) Existing rows are replaced by BCP.
Question 3
An UPDATE statement may modify how many tables?
A) One or more tables, provided the UPDATE statement is not operating on a view.
B) Only one, though triggers may cause additional side-effects.
C) Only one.
D) Up to sixteen
Question 4
Data and log files expand by what increment?
A) 8KB
B) 64KB
C) 512KB
D) 1MB
Question 5
Jamie is having a problem tracking down an issue users are having with a stored
procedure.
Users will occasionally have problems with the stored procedure running for an
excessive
amount of time, perhaps hours on end. There are no messages in the SQL Server
error log that
correspond to the times that users are having problems. Which of the following is
the most
likely cause and resolution?
A) The server is crashing and the users aren't able to access their data. Replace the
hardware.
B) The server is processing a database backup, and which is causing an excessive
amount of locking. Stop the automated backup jobs.
C) There is a problem with one or more user connections causing lock contention.
Use sp_who and DBCC INPUTBUFFER to track down the likely culprit.
D) There is a problem with one or more user connections causing lock contention.
Use sp_lock to track down the
Question 6
Which of the following commands are parts of the Data Definition Language (DDL)?
A) INSERT
B) CREATE TABLE
C) UPDATE
D) CREATE VIEW
Question 7
Consider the following table and trigger definitions: Table1: UserID int IDENTITY
FirstName
char(50) LastName char(50) DepartmentID int BillingID int CREATE TRIGGER
Table1_InsertUpdate ON
Table1 FOR INSERT, UPDATE AS BEGIN IF UPDATE(DepartmentID) IF (Select count(*)
from Table1
inner join Deleted on Table1.DepartmentID = deleted.departmentid) = 0 BEGIN
RAISERROR
('Cannot remove the last member from a department.', 16, 1) ROLLBACK END END
What does the
ROLLBACK statement in the trigger do?
A) It causes the transaction to roll back, aborting the INSERT or UPDATE that cause
the trigger to run,
but not aborting the transaction that the offending statement was part of.
B) It causes the transaction containing the offending statement to roll back.
C) Nothing; the keyword EXIT should have been used to abort the transaction.
D) It causes the transaction log to fill up.
Question 8
In order for her new application to process a sales record, Kim has to make sure that
the
application has collected enough information. For sales over $500, she needs to
have a valid
account manager's ID number. For sales over $1000, she needs to have a valid zip
code for
delivery to determine who gets commission. For sales over $10,000, she needs to
make sure that
enough stock is available. Which of the following would be a good way to check the
data prior
to inserting it?
A) Table constraints
B) Triggers
C) An inline table-valued function
D) A multi-statement table-valued function
Question 9
What is the maximum number of rows that a table can store in SQL Server 2000?
A) 255
B) 1,048,516
C) 2,147,483,647
D) No limit besides physical storage size
Question 10
If table_a has an insert trigger that performs an update on table_b, in which case
will the
update trigger on table_b be fired?
A) Your developers are probably not deallocating their cursors after processing the XML data.
B) The system is routinely encountering malformed XML and the accumulated errors are
crashing the system.
C) The XML strings are not being removed after being prepared and used.
D) A hardware problem is the root of your trouble.
Question 12
What are two advantages of triggers over rules and constraints? Choose two.
A) The ability to define boundaries within which the data must reside.
B) The ability to use looping structures.
C) The ability to reference data in other databases.
D) The ability to check data before it is logged.
Question 13
Which of the following is a good reason to use transactional replication?
A) It provides an up-to-the-second backup in case one of the sites in the replication model goes
down.
B) It provides a method for using a lot of resources on several servers in order to provide
up-to-the-second reporting capabilities.
C) It provides the lowest-overhead replication of any other type.
D) It is veryQuestion tolerant of network outages.
Question 14
When creating a table that contains a birth date for a person,
you want to ensure that a valid date is always entered. Which of the following is the best way to
accomplish this?
Question 15
Which of the following EXEC statements are valid? Choose all that apply.
A) exec ReturnValue = MyProc 5, 4, 'hello', @A OUTPUT
B) exec @ReturnValue = MyProc @length = 5, 4, 'Hello', @A OUTPUT
C) exec @ReturnValue = MyProc 5, 4, 'Hello', @A OUTPUT
D) exec @ReturnValue = MyProc @length = 5, @width = 4, @message = 'Hello', @A = @A
OUTPUT
Question 16
What tool included with SQL Server is primarily used for writing and executing ad-hoc queries?
Question 17
What are the three join operations SQL Server supports? Choose all that apply.
A) Nested loops
B) Merge join
C) Index spool
D) Hash match
Question 18
The graphical execution plan presented by SQL Server Query Analyzer uses different icons to
represent which of the following?
A) Physical operators
B) Logical Operators
C) T-SQL commands
D) Process flow
Question 19
Phil has created a new database that takes advantage of multiple physical disks on his server.
He has created his primary data file on one disk and placed a secondary data file on a separate
physical disk. The transaction log exists on the same physical disk as the primary file.
Phils plan is to put all user objects on the secondary data file and leave the system tables
on the primary data file. After creating all his objects, however, he quickly discovers that
they ended up on the primary file group. What might he have done wrong?
A) All objects are created on the primary data file until there is no more room.
Only after the primary data file is full will objects be created on the secondary data file.
B) He probably forgot to create the secondary data file as part of a separate file group.
Objects are created on file groups rather than on data files.
C) He probably forgot to declare the secondary data file as the default data file.
Objects are created on the default data file unless another data file is specified.
D) Nothing is actually wrong. SQL Server automatically assigns the secondary data file as the
primary file group so that all user defined objects will be created separately from the
primary data file.
Question 20
Which of the following best describes a situation in which the statistics for a table would
be misleading?
Question 21
Which of the following are results of specifying schema binding on a view?
Choose all that apply.
Question 22
George needs to write a view that can return one or more customers from a table given a last
name or part of a last name. Which of the following strategies will allow him to do that?
A) Write a view for every single last name that can be entered.
B) Write an application that automatically creates a new view for each last name in the database.
C) Pass a lastname parameter into the view.
D) Write a SELECT statement that references the view. Use the WHERE clause in the SELECT
statement to filter the data.
Question 23
Which of the following are parts of a SELECT statement? Choose all that apply.
A) FROM
B) SORT BY
C) WHERE
D) SELECT
Question 24
Which of the following features are new to SQL Server 2000? Choose all that apply.
Question 25
When is it important to use the WITH RECOMPILE option when creating a stored procedure?
Question 26
Given the following partial function definition, which SET statement shown below would
correctly accept the returned value? create function Area (l1 int, l2 int) returns int
A) set @A = dbo.area(5, 4)
B) set @A = area(5,4)
C) exec area(5, 4, @A OUTPUT)
D) set @A = dbo.@Area(5, 4)
Question 27
Consider the following table and trigger definitions:
Table1: UserID int IDENTITY FirstName char(50) LastName char(50) DepartmentID int
BillingID int
CREATE TRIGGER Table1_InsertUpdate ON Table1 FOR INSERT, UPDATE AS BEGIN IF
UPDATE(DepartmentID) IF (Select count(*) from Table1 inner join Deleted on
Table1.DepartmentID = deleted.departmentid) = 0 BEGIN RAISERROR
('Cannot remove the last member from a department.', 16, 1) ROLLBACK END END
What does the RAISERROR statement in the trigger do?
Question 28
Diane needs to enforce referential integrity on one of her tables. The data in one of the
columns should contain key values from a table residing in a database on the corporate server,
as opposed to her departmental server where her application database resides. She decides to
use constraints to enforce data integrity. How would you rate this solution?
A) This is an optimal solution. Using constraints to validate data entry is the best way to verify
referential integrity.
B) This is a fair solution. Although using constraints will work, it would be better to use triggers
to accomplish this goal.
C) This is a poor solution. It won't perform well, but it will work.
D) This solution won't work.
Question 29
Choose the statement that best describes a composite index.
Question 30
You need to install SQL Server Developer Edition on a spare machine to deliver to a new
developer in your company so he can study for his certification exam. Of the following machines
that can be spared,
what is the least powerful machine you can use for this purpose?
Question 31
Which of the following types of columns would be good candidates for an index? Choose all that
apply.
Question 32
What is the maximum number of rows that a table can store in SQL Server 2000?
A) 255
B) 1,048,516
C) 2,147,483,647
D) No limit besides physical storage size
Question 33
An UPDATE trigger typically accesses which of the following?
Question 34
Which of the following commands can best assist in diagnosing locking problems?
A) sp_lock
B) sp_who
C) DBCC SHOWLOCKS
D) SET SHOWLOCKS
Question 35
Which of the following commands can be used to interrupt processing of a While loop?
A) BREAK
B) HALT
C) EXIT
D) CONTINUE
Question 36
Choose all the statements that you could use in the WHERE clause to find only the rows
where the first name is Bobby or Bobbi. Choose all that apply.
Question 37
What are the space requirements for views?
A) Views require as much space as all the tables they are created from.
B) Views require as much space as would a table that presented the same data.
C) Views do not store data and therefore use no space.
D) Views require the space used to store a few records in various system tables.
Question 38
You have written a stored procedure that takes several parameters and uses them to issue
appropriate queries to the database. Most of the parameters are optional, and if all are passed
the resulting query you have to run can be quite complex. There is a great deal of conditional
logic in the procedure based on the parameters passed. When testing this procedure you found
that when you first created it, it worked great even though you started with a rather complicated
set of parameters. Since then performance has been disappointing. Every time you re-create it,
it works fast once, but rarely shows such speed on later calls. What is the most likely cause
of the problem?
A) You have specified the With Encryption option, which is causing additional overhead because
the procedure has to be decrypted each time it is run.
B) You have specified the With Recompile option, which is causing additional overhead because
the procedure has to recompile a new query plan every time.
C) You have forgotten to specify the With Recompile option, which is causing an inappropriate
query plan to be used with subsequent runs.
D) Your stored procedure cannot be helped. Stored procedures werent intended to handle
complex conditional logic.
Question 39
How does a TRUNCATE TABLE statement differ from an unrestricted DELETE? Select all that
apply.
Question 40
What is a valid GROUP BY clause for the following SELECT list? SELECT Pub_ID, Type,
Max(Price)
Question 41
Jesse's company has a central office and three remote locations. Each remote location has
three to five employees that run an order-taking application; they don't generate any reports
or need any additional data beyond their order-taking application. Each site has a modest but
reliable network connection to the central office. Which of the following is the best way for
Jesse to provide these users with access to the database?
Question 42
Eric needs to build a stored procedure to count the number of snack food vendors within his
zip code. Which of the following strategies would be the easiest to implement for passing and
returning values?
A) Pass the zip code in as a parameter; pass the number of vendors out as a return value.
B) Pass the zip code in as a parameter; pass the number of vendors out as an output parameter.
C) Use the stored procedure to call a scalar-valued user-defined function.
D) Pass the zip code in as a parameter; pass the output back in a temporary table.
Question 43
Carol wants to distribute the Personnel table, but needs to leave out a couple of columns
from the replication, such as the AnnualSalary column. What's the best way to do this?
Question 44
Which of the following are good uses for the I-SQL utility? Choose 2.
A) CHECK constraints are required to ensure that an inserted row goes to the correct table.
B) CHECK constraints are not required but can increase performance for inserts to the
partitioned view.
C) CHECK constraints serve no purpose for partitioned views.
D) CHECK constraints could conflict with the definition of the partitioned view and therefore
cannot exist on the tables that make up a partitioned view.
Question 46
Which of the following options will create a composite unique index on the CustomerID and
ProjectID fields in the CP table?
Question 47
Sam needs to set up her stored procedure so that when invalid data values are passed into the
stored procedure, the stored procedure will cause the application to see an error and have
SQL Server log an event into the error log. Which of the following will allow this to happen?
Question 48
Roger wants to create an index on a read-only table. What is the best option
he should use when creating the index?
A) FILLFACTOR = 100
B) FILLFACTOR = 0
C) PAD_INDEX, FILLFACTOR = 100
D) PAD_INDEX, FILLFACTOR = 0
Question 49
When using BCP to transfer data out of a table, which of the following statements apply? Choose
3.
A) Database users will not be able to access the table because BCP will lock it.
B) You must have SELECT permissions on the table.
C) Data changes made by other users during the BCP will not be reflected in the data file.
D) The contents of the data file are replaced if the data file already exists.
Question 50
Insensitive cursors provider what functionality?
A) They enable users to see data inserted since the time the cursor was opened.
B) They allow faster updates because the data for the cursor is stored in tempdb.
C) They cannot be scrolled backward because the data is discarded from the temporary storage
after it is fetched.
D) They ensure an unchanging view of the data as it was when the cursor was opened.
Question 51
What is the lifetime of a user-defined variable?
Question 52
To use full-text searching and find all rows containing forms of the verb "swim,"
you should use which CONTAINS predicate?
Question 53
Which of the following will help reduce deadlocks in your database?
A) Keeping the transaction isolation level as high as possible without hurting user concurrency
B) Always accessing tables in the same order in all programs
C) Never completing transactions until a user can confirm that the changes are correct
D) Always checking the state of @@TRANCOUNT before issuing a ROLLBACK command
Question 54
Sarah needs to figure out how to replicate data from all of her warehouses back to the
corporate office. She wants to store all the inventory information in one table, and all of
the information needs to be accessible to all of the warehouses and the corporate office, and
the information should be updateable at any location. The warehouses do not have reliable
network connections back to the corporate office. Which type of replication should Sarah use?
A) Snapshot replication
B) Merge replication
C) Transactional replication
D) Snapshot replication with Updating Subscribers
Question 55
When creating a database with the CREATE DATABASE command, in what units can the file
size be
specified? Choose all that apply.
A) MB (Megabytes)
B) Number of pages
C) Number of extents
D) KB (Kilobytes)
Question 56
Eddie needs to have a database that is replicated to other locations. They have highly
redundant network connectivity to all of the other locations, and a very large central server.
Changes to the database need to be made at every site, and need to be done instantaneously at
every site, with no delay. Which type of replication would work best for Eddie?
A) Merge replication
B) Transactional replication
C) Snapshot replication
D) Snapshot replication with updates
Question 57
Which of the following are aggregate functions? Choose 3.
A) Sum
B) ABS
C) Max
D) Count
Question 58
Barney wrote this stored procedure to manage inserts to his Sales table: CREATE PROCEDURE
InsertSale @SalesPersonID int, @ProductID int, @Quantity int, @CustomerID int AS
If @Quantity > 0 Insert Sales (SalesPersonID, ProductID, Quantity, CustomerID) VALUES
(@SalesPersonID, @ProductID, @Quantity, @CustomerID) else RAISERROR
('Unable to enter negative or 0 quantity into Sales table.', 16, 1) GO
If there are no constraints on the table, how can Barney make sure that the value of
@SalesPersonID is valid?
A) Check the Sales table and see whether there are any other rows in that table for that
SalesPersonID.
B) Check the table in which SalesPersonID is a Primary Key to ensure that the value is valid.
C) Attempt the insert and check to see whether the foreign key constraint causes an error.
D) It's not possible to access more than one table in a stored procedure.
Question 59
Which queries will return all the names in the Authors table sorted by first name, then last?
Choose 2.
Question 60
When using an INSERT statement, data to be inserted may come from which of the following?
Select all that apply.
Question 61
Which of the following are reasons to choose SQL Server 2000? Choose all that apply.
A) Internet integration
B) Scalability and availability
C) Enterprise-Level Database features
D) Data warehousing
Question 62
You were recently hired to oversee the installation of SQL Server to support a new accounting
package for a small business. The company is cost-conscious, so you need to make a
conservative
recommendation about where to install SQL Server in the company's existing structure. Which of
the following makes the best choice to support SQL Server?
A) Dual-processor machine with 512MB memory currently acting as an Exchange server
B) A single-processor 800MHz Pentium with 256MB memory currently acting as a Primary
Domain Controller.
C) A spare Pentium 90MHz laptop with 128MB of memory
D) Pentium 1GHz machine with 512MB memory recently purchased to replace the president's
workstation
Question 63
How is a NOT NULL column added to an existing table?
Question 64
Omitting the WHERE clause of an UPDATE or DELETE statement has what effect?
Question 65
What statement could you use in the WHERE clause to select all the rows in a table where no
price is defined?
Question 66
Consider the following table and trigger definitions: Table1: UserID int IDENTITY FirstName
char(50)
LastName char(50) DepartmentID int BillingID int CREATE TRIGGER Table1_InsertUpdate
ON Table1
FOR INSERT, UPDATE AS BEGIN IF UPDATE(DepartmentID) IF (Select count(*) from
Table1 inner join
Deleted on Table1.DepartmentID = deleted.departmentid) = 0 BEGIN RAISERROR
('Cannot remove the last member from a department.', 16, 1) ROLLBACK END END Assuming
that this
is the only trigger bound to the table, is it possible for the last member of a department to
be deleted?
Question 67
Referential integrity refers to what?
Question 68
Barney wrote this stored procedure to manage inserts to his Sales table:
CREATE PROCEDURE InsertSale @SalesPersonID int, @ProductID int, @Quantity int,
@CustomerID int
AS If @Quantity > 0 Insert Sales (SalesPersonID, ProductID, Quantity, CustomerID) VALUES
(@SalesPersonID, @ProductID, @Quantity, @CustomerID) else RAISERROR
('Unable to enter negative or 0 quantity into Sales table.', 16, 1) GO What does the
RAISERROR statement do?
A) The RAISERROR will cause the row to not be inserted into the database.
B) It provides feedback to the calling application so it can diagnose why the insert failed.
C) It will cause SQL Server to shut down because a severity 1 error occurred.
D) It will do nothing.
Question 69
SQL Sever maintains what types of information about a column in the table definition?
Question 70
DTS Package Designer tasks can be set to run in what ways? Choose all that apply.
A) On completion
B) On failure
C) On error
D) On success
Database Optimization
1. What are indexes
2. What are B-Trees?
3. I have a table which has lot of inserts, is it a good database design to create
indexes on that table?
4. What are Table Scans and Index Scans?
5. What are the two types of indexes and explain them in detail?
6. What is FillFactor concept in indexes?
7. What is the best value for FillFactor?
8. What are Index statistics?
9. How can we see statistics of an index?
10. How do you reorganize your index, once you find the problem?
11. What is Fragmentation?
12. How can we measure Fragmentation?
13. How can we remove the Fragmented spaces?
14. What are the criteria you will look in to while selecting an index?
15. What is Index Tuning Wizard?
16. What is an Execution plan?
17. How do you see the SQL plan in textual format?
18. What is nested join, hash join and merge join in SQL Query plan?
19. What joins are good in what situations?
20. What is RAID and how does it work
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section
where as Stored procedures cannot be.
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other
tables.
Inline UDF's can be though of as views that take parameters and can be used in JOINs and other
Rowset operations.
Using the NOLOCK query optimiser hint is generally considered good practice in order to
improve concurrency on a busy system. When the NOLOCK hint is included in a SELECT
statement, no locks are taken when data is read. The result is a Dirty Read, which means that
another process could be updating the data at the exact time you are reading it. There are no
guarantees that your query will retrieve the most recent data. The advantage to performance is
that your reading of data will not block updates from taking place, and updates will not block
your reading of data. SELECT statements take Shared (Read) locks. This means that multiple
SELECT statements are allowed simultaneous access, but other processes are blocked from
modifying the data. The updates will queue until all the reads have completed, and reads
requested after the update will wait for the updates to complete. The result to your system is
delay(blocking).
1 comment: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
One-to-One relationship can be implemented as a single table and rarely as two tables with
primary and foreign key relationships.
One-to-Many relationships are implemented by splitting the data into two tables with primary
key and foreign key relationships.
Many-to-Many relationships are implemented using a junction table with the keys from both the
tables forming the composite primary key of the junction table.
Case sensitivity
Accent sensitivity
Kana Sensitivity
When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana
sensitive.
Width sensitivity
When a single-byte character (half-width) and the same character when represented as a double-
byte character (full-width) are treated differently then it is width sensitive.
SQL server : What are the different index configurations a table can have?
No indexes
A clustered index
A nonclustered index
SQL Server : What are the difference between clustered and a non-clustered
index?
A clustered index is a special type of index that reorders the way records in the table are
physically stored. Therefore table can have only one clustered index. The leaf nodes of a
clustered index contain the data pages.
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
BulkCopy is a tool used to copy huge amount of data from tables and views. But it won't copy
the structures of the same.
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
SQL Server : What is log shipping?
Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000.
We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can
configure the logshipping. In logshipping the transactional log file from one server is
automatically updated into the backup database on the other server. If one server fails, the other
server will have the same db and we can use this as the DR (disaster recovery) plan.
SQL Server : Where do you think the users names and passwords will be stored
in sql server?
Database : How do you troubleshoot SQL Server if its running very slow?
First check the processor and memory usage to see that processor is not above 80% utilization
and memory not above 40-45% utilization then check the disk utilization using Performance
Monitor, Secondly, use SQL Profiler to check for the users and current SQL activities and jobs
running which might be a problem. Third would be to run UPDATE_STATISTICS command to
update the indexes
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Database : Can you explain the role of each SQL Server service?
SQL SERVER - is for running the databases SQL AGENT - is for automation such as Jobs, DB
Maintanance, Backups DTC - Is for linking and connecting to other SQL Servers
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Database : What are the OS services that the SQL Server installation adds?
MS SQL SERVER SERVICE, SQL AGENT SERVICE, DTC (Distribution transac co-ordinator)
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Database : Which stored procedure will you are running to add a linked server?
sp_addlinkedserver, sp_addlinkedsrvlogin
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Database : Can you link only other SQL Servers or any database servers such as
Oracle?
We can link any server provided we have the OLE-DB provider from Microsoft to allow a link.
For Oracle we have a OLE-DB provider for oracle that microsoft provides to add it as a linked
server to the sql server group.
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
SQL Profiler utility allows us to basically track connections to the SQL Server and also
determine activities such as which SQL Scripts are running, failed jobs etc..
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Join actually puts data from two or more tables into a single result set.
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Collation is basically the sort order. There are three types of sort order Dictionary case sensitive,
Dictonary - case insensitive and Binary.
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause
is applied to each row before they are part of the GROUP BY function in a query.
No comments: Links to this post
Labels: Database Questions With Answer, SQL Server Questions With Answer
Database : What command do we use to rename a db?
Well sometimes sp_reanmedb may not work you know because if some one is using the db it will
not accept this command so what do you think you can do in such cases? - In such cases we can
first bring to db to single user using sp_dboptions and then we can rename that db and then we
can rerun the sp_dboptions command to remove the single user mode.
2. Q. How do you list all files in a directory, including the hidden files?
A. ls -a (-a, do not hide entries starting with .)
3. Q. How do you find out all processes that are currently running?
A. ps -f (-f does full-format listing.)
4. Q. How do you find out the processes that are currently running or a particular
user?
A. ps -au Myname (-u by effective user ID (supports names)) (a - all users)
8. Q. What would you use to view contents of a large error log file?
A. tail -10 file_name ( last 10 rows)
12.Q. How do you create a symbolic link to a file (give some reasons of doing so)?
A. ln /../file1 Link_name
Links create pointers to the actual files, without duplicating the contents of
the files. That is, a link is a way of providing another name to the same file.
There are two types of links to a file:Hard link, Symbolic (or soft) link;
15.Q. How do you check the sizes of all users home directories (one command)?
A. du -s
df
Q. in current directory
A. ls -ps (p- directory; s - size)
A. bg %4 (job 4)
18 Q. What utility would you use to replace a string '2001' for '2002' in a text file?
A. Grep, Kde( works on Linux and Unix)
19. Q. What utility would you use to cut off the first column in a text file?
A. awk, kde
27. Q. What command do you type to find help about the command who?
A. $ man who
28. Q. What is the difference between home directory and working directory?
A. Home directory is the directory you begin at when you log into the
system. Working directory can be anywhere on the system and it is where you are
currently
working.
29. Q. Which directory is closer to the top of the file system tree, parent directory or
current directory?
A. The parent directory is above the current directory, so it is closer to
the root or top of the
file system.
32. Q. What are two subtle differences in using the more and the pg commands?
A. With the more command you display another screenful by pressing
the spacebar, with pg you press the return key.
The more command returns you automatically to the UNIX
shell when completed, while pg waits until you press return.
33. Q. When is it better to use the more command rather than cat command?
A. It is sometimes better to use the more command when you are viewing
a file that will display over one screen.
34. Q. What are two functions the move mv command can carry out?
A. The mv command moves files and can also be used to rename a file or directory.
36. The soccer league consists of boy and girl teams. The boy file names begin
with B, the girl teams begin with G. All of these files are in one directory
called "soccer", which is your current directory:
Bteam.abc Bteam.OOl Bteam.OO2 Bteam.OO4
Gteam.win Gteam.OOl Gteam.OO2 Gteam.OO3
Write the commands to do the following:
a) rename the file Bteam.abc to Bteam.OO3.
b) erase the file Gteam. win after you have viewed the contents of the file
c) make a directory for the boy team files called "boys", and one for the girl team
files
called" girls"
d) move all the boy teams into the "boys" directory
e) move all the girl teams into the "girls" directory
f) make a new file called Gteam.OO4 that is identical to Gteam.OOl
g) make a new file called Gteam.OO5 that is identical to Bteam.OO2
A.
a) mv Bteam.abc Bteam.OO3.
b) cat Gteam.win -or- more Gteam.win
rm Gteam. win
c) mkdir boys
mkdir girls
d) mv Bteam* boys
e) mv Gteam* girls
f) cd girls
cp Gteam.OO1 Gteam.OO4
g) There are several ways to do this. Remember that we are currently in the
directory
/soccer/girls.
cp ../boys/Bteam.OO2 Gteam.OO5
or
cd ../boys
cp Bteam.OO2 ../girls/Gteam.OO5
37. Q. Draw a picture of the final directory structure for the "soccer"
directory, showing all the files and directories.
40. Q. Which of the quoting or escape characters allows the dollar sign ($) to retain
its special meaning?
A. The double quote (") allows the dollar sign ($) to retain its special meaning.
Both the backslash (\) and single quote (') would remove the special meaning of the
dollar sign.
55. Q.How do you execute a program or script, my_script in your current directoty?
A. ./my_script
59. Q. How to find difference in two configuration files on the same server?
A. Use diff command that is compare files line by line
diff -u /usr/home/my_project1/etc/ABC.conf /usr/home/my_project2/etc/ABC.conf
60. Q. What is the best way to see the end of a logfile.log file?
A. Use tail command - output the last part of files
tail -n file_name ( the last N lines, instead of the last 10 as default)
No comments: Links to this post
Labels: Linux, Unix
Linux Interview Question
What is SELinux?
What is the most graceful way to get to run level single user mode?
Write a command to find all of the files which have been accessed within the last 10
days.
How do I find whether a parameter exists in the request object?
What does Security-enhanced Linux give me that standard Linux cant?
What can you type at a command line to determine which shell you are using?
In order to display the last five commands you have entered using the fc command,
you would type?
What command should you use to check your filesystem?
What file defines the levels of messages written to system log files?
What account is created when you install Linux?
What daemon is responsible for tracking events on your system?
Where is standard output usually directed?
What utility can you use to show a dynamic listing of running processes?
Who owns the data dictionary?
Compare Linux credit based algorithm with other scheduling algorithms?
What is the main advantage of creating links to a file instead of copies of the file?
What is LILO?
What is CVS?
What is NFS? What is its job?
In Linux OS, what is the file server?
What are the techniques that you use to handle the collisions in hash tables?
What is the major advantage of a hash table?
What is Write Command ?
Why You Shouldnt Use the root Login?
How big should the swap-space partition be?
Which field is used to define the users default shell?
When you create a new partition, you need to designate its size by defining the
starting and ending?
No comments: Links to this post
PL/SQL Interview Question
How do you convert a date to a string?
What is an aggregate function?
What is the dual table?
What are cursors? Distinguish between implicit and explict cursors?
Explain how cursors are used by Oracle?
What is PL/SQL? Describe the block structure of PL/SQL?
What is a nested subquery?
What are the various types of queries ?
Which of the following is not a schema object : Index, table, public synonym, trigger
and package ?
What is dynamic sql in oracle?
What is the difference between a package, procedure and function
What is the difference between delete, drop and truncating a table
How many triggers are supported in Oracle
Are you aware of FLASHBACK concept ? What is it?
Describe oracles logical and physical structure?
What is data dictionary
What is the use of control files
How would store XML data in table ? What data type would be used for the
columns?
Difference between post and commit?
Difference between commit and rollback?
What are savepoints?
Difference between a View and Synonym
How would you fetch system date from oracle
What is the difference between primary key, unique key, foreign key?
What is the difference between NO DATA FOUND and %NOTFOUND
What is cursor for loop
What are cursor attributes
What will you use in Query : IN or EXISTS? Why
Explain the difference between a data block, an extent and a segment.
What's the difference between logical and physical I/O?
What is an anonymous block?
What is a PL/SQL collection?
How do I find the overall database size?
The biggest portion of a database's size comes from the datafiles. To find out how
many megabytes are allocated to ALL datafiles:
select C.INSTANCE,
to_date(JUL.VALUE, 'J')
|| to_char(floor(SEC.VALUE/3600), '09' )
|| ':'
-- || substr (to_char(mod(SEC.VALUE/60, 60), '09'), 2, 2)
|| substr (to_char(floor(mod(SEC.VALUE/60, 60)), '09'), 2, 2)
|| '.'
|| substr (to_char(mod(SEC.VALUE, 60), '09'), 2, 2) STARTED
from SYS.V_$INSTANCE JUL,
SYS.V_$INSTANCE SEC,
SYS.V_$THREAD C
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
select to_date(JUL.VALUE, 'J')
|| to_char(to_date(SEC.VALUE, 'SSSSS'), ' HH24:MI:SS') STARTED
from SYS.V_$INSTANCE JUL,
SYS.V_$INSTANCE SEC
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
select to_char(to_date(JUL.VALUE, 'J') + (SEC.VALUE/86400), -- Return a DATE
'DD-MON-YY HH24:MI:SS') STARTED
from V$INSTANCE JUL,
V$INSTANCE SEC
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
No comments: Links to this post
Labels: Oracle FAQ, Oracle Interview Questions With Answer
Can one rename a tablespace?
From Oracle 10g Release 1, users can rename tablespaces. Example:
ALTER TABLESPACE ts1 RENAME TO ts2;
However, you must adhere to the following restrictions:
COMPATIBILITY must be set to at least 10.0.1
Cannot rename SYSTEM or SYSAUX
Cannot rename an offline tablespace
Cannot rename a tablespace that contains offline datafiles
For older releases, use the following workaround:
Export all of the objects from the tablespace
Drop the tablespace including contents
Recreate the tablespace
Import the objects
No comments: Links to this post
Labels: Oracle FAQ, Oracle Interview Questions With Answer
Can one rename a database user (schema)?
No, this is listed as Enhancement Request 158508. Workaround:
Assume that Arjan, Bhuvan, Guran and Lakha had A, B, G and L sheep respectively.
As it is given that at the end each would have an equal number of sheep, comparing
the final numbers from the above table.
Also, it is given that Guran had ten more sheep than Lakha.
G = L + 10
11A/18 = A/2 + 10
A/9 = 10
A = 90 sheep
Thus, Arjan had 90 sheep, Bhuvan had 5A/9 i.e. 50 sheep, Guran had 11A/18 i.e. 55
sheep and Lakha had A/2 i.e. 45 sheep.
Consider a number 235, where last digit is the sum of first two digits i.e. 2 + 3= 5.
How many
Find the smallest number such that if its rightmost digit is placed at its left end, the
new number so formed is precisely 50% larger than the original number.
Answer
If its rightmost digit is placed at its left end, then new number is 428571 which is
50% larger than the original number 285714
The simplest way is to write a small program. And the other way is trial and error !!!
Two identical pack of cards A and B are shuffled throughly. One card is picked from A
and shuffled with B. The top card from pack A is turned up. If this is the Queen of
Hearts, what are the chances that the top card in B will be the King of Hearts?
Answer 52 / 2703
CASE 1 : King of Hearts is drawn from Pack A and shuffled with Pack B
Probability of drawing King of Hearts from Pack A = 1/51 (as Queen of Hearts is not
to be drawn)
Probability of having King of Hearts on the top of the Pack B = 2/53
Probability of not drawing King of Hearts from Pack A = 50/51 (as Queen of Hearts is
not to be drawn)
Probability of having King of Hearts on the top of the Pack B = 1/53
There is a 4-character code, with 2 of them being letters and the other 2 being
numbers.
How many maximum attempts would be necessary to find the correct code? Note
that the code is case-sensitive.
Answer
How many ways are there of arranging the sixteen black or white pieces of a
standard international chess set on the first two rows of the board?
Given that each pawn is identical and each rook, knight and bishop is identical to its
pair.
There are total 16 pieces which can be arranged on 16 places in 16P16 = 16! ways.
(16! = 16 * 15 * 14 * 13 * 12 * ..... * 3 * 2 * 1)
******************************************************************
A person with some money spends 1/3 for cloths, 1/5 of the remaining for food and
1/4 of the remaining for travel. He is left with Rs 100/-
Again, he spent 1/4 of remaining maoney for travel = (1/4) * (8/15) * X = (2/15) * X
Remaining money = (8/15) * X - (2/15) * X = (6/15) * X
Grass in lawn grows equally thick and in a uniform rate. It takes 24 days for 70 cows
and 60 days for 30 cows to eat the whole of the grass.
Answer 20 cows
There is a safe with a 5 digit number as the key. The 4th digit is 4 greater than the
second digit, while the 3rd digit is 3 less than the 2nd digit. The 1st digit is thrice
the last digit. There are 3 pairs whose sum is 11.
Answer 65292
As per given conditions, there are three possible combinations for 2nd, 3rd and 4th
digits. They are (3, 0, 7) or (4, 1, 8) or (5, 2, 9)
It is given that there are 3 pairs whose sum is 11. All possible pairs are (2, 9), (3, 8),
(4, 7), (5, 6). Now required number is 5 digit number and it contains 3 pairs of 11.
So it must not be having 0 and 1 in it. Hence, the only possible combination for 2nd,
3rd and 4th digits is (5, 2, 9)
Also, 1st digit is thrice the last digit. The possible combinations are (3, 1), (6, 2) and
(9, 3), out of which only (6, 2) with (5, 2, 9) gives 3 pairs of 11. Hence, the
answer is 65292.