Pages

Wednesday 6 March 2013

sql 2008 exam practice Q/A.



1.     DISTINCT keyword is used to retrieve column values with no repetition.                           
            T          F
2.     There is no difference between unique key constraint and primary key constraint.  
            T          F
3.     Unique key constraint restricts for null values as Primary key does.                                                           
T          F
4.     Foreign key is used to identify records uniquely in a table.                                                            
T          F
5.     Information is defined as the processed and meaningful form of the raw data.                    
            T          F
6.     The size of data type ‘smallint’ is 1 byte.                                                                         
            T          F
7.     Drop Command and Delete command for a table does the same job.                                             
            T          F
8.     Bit datatype is used to store yes/no (true/false) values.                                                    
            T          F
9.      DISTINCT keyword is used to retrieve column values with no repetition.                                       T            F
10.  There is no difference between unique key constraint and primary key constraint.                           T            F
11.  Unique key constraint restricts for null values as Primary key does.                                                  T            F
12.  Foreign key is used to identify records uniquely in a table.                                                               T            F
13.  Information is defined as the processed and meaningful form of the raw data.                                T            F
14.  The size of data type ‘smallint’ is 1 byte.                                                                                           T            F
15.  Drop Command and Delete command for a table does the same job.                                                           T          F
16.  Bit datatype is used to store yes/no (true/false) values.                                                                      T            F
17.  Syntax for the command to create table is
a.     Create table <tablename>
b.     Create <tablename>

18.  “Delete From <tablename>” and “Truncate table <tablename>” provides
a.     same functionality i.e. used to delete specified table from the database
b.     same functionality i.e. used to delete all rows (records) in specified table
c.     different functionality


19.  Left Outer Join operation results in
a.     Records all from left table but matched ones from right table
b.     Records from both the tables whether they match or not.
c.     Records from left table only

20.  Referential Integrity states that
a.     a database must not contain any unmatched foreign key values
b.     a database must contain unmatched foreign key values

21.  DML stands for
a.     Data Markup Language
b.     Data Manipulation Language

22.  SELECT name FROM users WHERE job=’Software Developer’ OR city=’Karachi’
a.     It will return the names when both scenarios match
b.     It will return the names when at least a single match is found.

23.  Create table Reservation (SeatNovarchar(3), PassengerNo Varchar(5))
a.     This command will return a syntax error
b.     This command will create a table named as “Reservation”

24.  Domain Integrity enforces
a.     valid values to be entered in a column.
b.     A column to be unique

25.  Identify the query used to view the index created on the table?
a.       sp_index<table_name>
b.    sp_helpindex <table_name>
c.       index <table_name>
d.      index_help<table_name>

26.  In SQL Server 2005, the ownership of a user database can be changes. ... procedure to change the ownership of a database. *
a.       sp_changedbowner.
b.      sp_changeowner
c.       change_db_owner.

27.   The Process of processing a set of commands one at a time from a batch of command called
a.        Command Processing.
b.       Batch Processing.
c.        Set Processing.
d.       Singular Processing

28.   __________ Statements are used for securing the database.
a.       DDL   
b.      DML  
c.       Batch  
d.      DCL

29.  The System stored procedure ____ is used to change ownership of database.
a.       DBCC SHRINKDATABASE.         
b.      sp_changedbowner    
c.       sp_dboption   
d.      sp_renamedb.

30.  The _____ data model allows a child node to have more than one parent.
a.       Flat-File          
b.      Hierarchical    
c.       Network

31.  Which trigger is used to enforce referential integrity?
a.       Cascading trigger
b.      Update trigger
c.       Nested trigger

32.  We can use the Alter table command to drop the constraint from a table
a.       True
b.      False

33.  Syntax for the command to create table is
a.       Create table <tablename>
b.      Create <tablename>

34.  “Delete From <tablename>” and “Truncate table <tablename>” provides
a.       same functionality i.e. used to delete specified table from the database
b.      same functionality i.e. used to delete all rows (records) in specified table
c.       different functionality

35.  Left Outer Join operation results in
a.       Records all from left table but matched ones from right table
b.      Records from both the tables whether they match or not.
c.       Records from left table only

36.  Referential Integrity states that
a.       a database must not contain any unmatched foreign key values
b.      a database must contain unmatched foreign key values

37.  DML stands for
a.       Data Markup Language
b.      Data Manipulation Language

38.  SELECT name FROM users WHERE job=’Software Developer’ OR city=’Karachi’
a.       It will return the names when both scenarios match
b.      It will return the names when at least a single match is found.

39.  Create table Reservation (SeatNovarchar(3), PassengerNo Varchar(5))
a.       This command will return a syntax error
b.      This command will create a table named as “Reservation”

40.  Domain Integrity enforces
a.       valid values to be entered in a column.
b.      A column to be unique

41.  The _____ data model allows a child node to have more than one parent.
a.       Flat-File          
b.      Hierarchical    
c.       Network

42.  A relational database is a database structure on the _____ model.
a.       Network         
b.      Relational       
c.       Hierarchical
d.      Flat-File

43.  _____ is used to administer permission for the database and database objects.
a.       Data Definition Language (DDL)     
b.      Data Manipulation Language (DML)
c.       Sub-scheme    
d.      Data Control Language (DCL)

44.  In the relational model terminology, a row is called a ____, a Column an______ and the table is called a _____.
a.       Tuple, Attribute, Relation      
b.      Attribute, Tuple, Relation
c.       Row, Column, Tuple.

45.  A ____ can be defined as a collection of related records and a set of programs that access and manipulate these records.
a.       Database Management System          
b.      Relational Database Management System.
c.       Data Management      
d.      Network Model

46.   ____ describe container for storing data, process of storing and retrieving data from that container.
a.       Network Model         
b.      Database Model/Data Model 
c.       Flat-File Model          
d.      Relational model.

47.  During logical data modeling, the data modeler develops a ___ description of the data and the various entities involved with it.
a.       Detailed         
b.      Superficial

48.  One or more attributes that can uniquely define an entity from an entity set is called a ____
a.       Primary           
b.      Candidate      
c.       Alternate        
d.      Super.

49.  An attribute that contains two or more attribute values in it is called a ___ attribute.
a.       Derived          
b.      Composite
c.       Multivalve.

50.  Transitive dependence is eliminated in the ________ normal Form.
a.       First    
b.      Second           
c.       Third  
d.      Fourth.

51.  The _______ operation is further enhanced in the _______ operation.
a.       Product          
b.      Intersection    
c.       Difference      
d.      Join.

52.  ______ defines rules regarding the values allowed in columns and is the standard mechanism for enforcing data integrity.
a.       Table
b.      Index  
c.       Constraints     
d.      Rules.

53.  ______ And _____ are the two types of file groups in SQL Server 2005.
a.       Primary           
b.      Secondary      
c.       User Defined
d.      Log Files.

54.  ______ Clause returns a limited number of rows from a table in from clause to a sample number or percent of rows.
a.       Output
b.      TOP    
c.       Table Sample
d.      With.

55.  ______ Statements are used for securing the database.
a.       DDL   
b.      DML  
c.       Batch  
d.      DCL

56.  ______ Operator operate only on one operand to perform arithmetic operations.
a.       Bitwise           
b.      Assignment    
c.       Relational       
d.      Unary.

57.  ______ is a collection of one or more Transact-SQL statements sent at one time from an application to SQL Server for execution.
a.       Batch  
b.      Group 
c.       Order  
d.      Collection.

58.  ______ Function is used to assist with the summarization of large volumes of data.
a.       Aggregate      
b.      System
c.       Conversion.

59.  _____ is used as an alias for a table name.
a.       AS Clause      
b.      From
c.       INTO
d.      Where

60.  _____ Keyword displays only the top few rows of the result set.
a.       View  
b.      Percent           
c.       TOP    
d.      Distinct.

61.  _____ displays a string of any length.
a.       [ ]        
b.      %        
c.       -          
d.      [^]

62.  _____ Clause with _____ keyword restricts the number of rows to be grouped.
a.       Where and Group by             
b.      Having and Group by.                       
c.       All and Group by.

63.  _____ Clause sorts the result set in a particular order.
a.       Group by        
b.      Order by         
c.       Where 
d.      ASC.

64.  Which of the following data types does not belong to exact numeric Category?
a.       Tiny Int          
b.      Big Int
c.       Float   
d.      Money

65.  Which of these commands is used to remove a table when no longer required?
a.       Remove Table
b.      Alter table Remove
c.       Alter Table Drop
d.      Drop table tblName.

66.  _______ Operator is used to display only the rows that are common to both the tables.
a.       Intersect         
b.      Union 
c.       Except
d.      Union All

67.  _______ is formed when records from two tables are combined only if the rows from both the tables are matched based on a common column.
a.       Inner Join
b.      Left Outer Join
c.       Self Join
d.      Right Outer Join.

68.  Which of the following can be used with sub queries that return one column and many rows?
a.       Any    
b.      All      
c.       IN       
d.      =

69.  Collection of Data is called information  _____T___ .
70.  Collection of information is called Records ____T____ .
71.  Collection of Records is called Tables ________ .T
72.  Collection of Tables is called Database _____T___ .
73.  DBMS stands for _______________________dont know   ___________.
74.  Any Database consist on three major languages/Operations:
a.       DDL
b.      DML
c.       DCL
75.  Write commands used in DML, DDL, DCL.
76.  Write operation/Command used by Database Administrator.
77.  What is Stored Procedure? Write types of Stored Procedure and their Names.
78.  What is Trigger? Why it is used? Write types of Triggers?
79.  Write the command to create a Database “APTECHDB”
80.  Write all aggregate functions and their use.

sql 2008 exam practice questions.


1.       ___________________ is a collection of related data stored in the form of data.
a)      Database
b)      Database management system

2.       A________________________________ can be define as a collection of related records and a set of programs that access and manipulate these records.
a)      Database
b)      Database management system
c)       Relational database management System.

3.  A_____________________ ________ is a rule of software programs for creating, maintaining, modifying, and manipulating a relational database.
a)   Database
b)   Database management system
c)   Relational database management System.

4. The_________________ data model allows a child node to have more than one parent.
a) Falt-file
b) Hierarchical
c)  Network

5. ___________________is used to administer permission on the database and database objects.
a)      Data Definition Language (DDL)
b)      Data manipulation Language (DML)
c)       Sub-Schema
d)      Data control Language (DCL)

6. An attribute that contain two or more attribute valus in it is called a________________ attribute.
a)      Derived
b)      Composite
c)       Multivalued

7. The_______________ operation is further enhanced in the __________________ operation.
a)      Product
b)      Intersection
c)       Difference
d)      Join



8. _____________provides an implementation of SOA to build a message queuing system for reliable and secure database.
a)      Service Oriented architecture
b)      Enterprise architecture
c)       Service broker

9. ______________________ defines rules and processes to allow many clients for accessing tha data servers via business services.
a)      Abstraction layer
b)      Data presentation layer
c)       Business service layer
d)      Data service layer.

10. The_______________ clause returns a limited number of rows from a table in the FROM clause to a sample number or percent of rows.
a)      OUTPUT
b)      TOP
c)       TABLESAMPLE
d)      WITH

11. ____________operator takes rows and puts them into columns.
a)      UNPIVOT
b)      ANY
c)       PIVOT
d)      SOME

12. A_____________ is a collection of one or more Transaction statements sent at one time.
a)      Batch
b)      Group
c)       Order
d)      Collection

13. ________________  function is used to assist with the summarization of large volumes of data.
a)      Aggregate
b)      System
c)       Conversion

14. The system stored procedure _____________ is used to change ownership of databases.
a)      DBCC SHRINKDATABASE
b)      Sp_changedbowner
c)       Sp_dboption
d)      Sp_renamedb

16. ALTER DATABASE Employee MODIFY NAME  =  Emp_DB changes the_______________
a)      Database name
b)      Database primary file name
c)       Database logical file name

17. Every database has a _________________filegroup by default.
a)      Primary
b)      Secondary
c)       User-defined
d)      System

18. ____________ displays a string of any length.
a)      []
b)      %
c)       _
d)      [^]

19. The ______________clause with_________ keyword restricts the number of rows to be grouped.
a)      WHERE and GROUPBY
b)      HAVING and GROUPBY
c)       ALL and GROUPBY

20. What is the function that can be used to determine if a table has a globally unique identifier ?
a)      GLOBALUNIQUE
b)      Uniqueidentifier
c)       OBJECTPROPERTY()
d)      NEWID()

21. Which of the following xml data type method can be used to retrieve entire or specific part of an XML instance ?
a)      Query()
b)      Retrieve()
c)       Get()
d)      Value()



     22. Which of these is the correct statement to create an alias type based on system defined type nvarchar of length 30 and which prevents of null values ?
            a) CREATE TYPE newtype BASED ON nvarchar(30) NOT NULL
            b) CREATE TYPE newtype FROM nvarchar(30) NULL NOT ALLOWED
            c) CREATE TYPE usertype FROM nvarchar(30) NULL
            d) CREATE TYPE usertype FROM nvarchar(30) NOT NULL

  23. The _________________ operator is used to display only the rows that are common to both the table.
    a) INTERSECT
   b) UNION
  c) correlated subquery
  d)  parent query

24. _____________________ is formed when records from two table are combined only if the rows from both the table are matched based on a common column.
   a) INNER join
  b) Left Outer Join
  c) Self join
  d) Right outer join

25. Outer join can be either right outré join or left outer join.
    a) TRUE
    b) FALSE

26. Which of the following can be used with subqueries that return one column and many rows.
    a) ANY
    b) ALL
    c) IN
    d)  =

27. Using the CONVERT () function a value of one data type can be transformed to another. Which of the following syntax will help you to achieve this?
a: CONVERT(datatype1,datatype2).
b: CONVERT(datatype[length],expression[style]).
c: CONVERT(datatype,expression).
d: CONVERT(expression1,expression2)


28. Which of the following codes creates a variable of XML data type?
1.      DECLARE @xmlvar xml
     SELECT @xmlvar=’<Employee name=”joan”/>’

2.      DECLARE @xmlvar xml
       SELECT @xmlvar=<Employee name=joan>

3.      DECLARE @xmlvar xml
      SELECT @xmlvar=’<Employee name=”joan”’

4.      DECLARE @xmlvar xml
        SELECT @xmlvar=<Employee name=”joan”/>
29. Every table have only one primary key constrain. You can add a primary key by using which of the following syntax?
1.     CREATE TABLE <table_name>(Column_name datatype PRIMARY KEY {,column_list})
2.     CREATE TABLE <table_name>(Column_name datatype PRIMARY KEY {column_list})
3.     CREATE TABLE <table_name>(Column_name datatype PRIMARY KEY {column_list});

30. The _______________ indexing features allows complex queries to be formed on character data.
         a) Partitioned Index
          b) Unique index
          c) Full-text Index

31. Which of the following are the features of Trigger.
      a) A trigger can be created only in the current databse.
      b) A table can have only single insert, update and delete triggers.
       c) A trigger can be applied to only one table.