Are you a candidate looking to sharpen your skills? Try our practice tests or view sample interview questions & Get hired by the best. Click Here×

Microsoft SQL Server 2012 Online Developer Test

Topics Covered

  • Querying Microsoft SQL Server 2012 database
  • Architecture and Editions of SQL Server 2012
  • Sorting and Filtering Data
  • Built-In Functions
  • Implementing Error Handling
  • Transactions
  • Design & implementation of a Data Warehouse with Microsoft SQL Server 2012
  • Sequence Object
  • Contained Database
  • Improvement in FILESTREAM Storage
  • Enhancements in Transact-SQL Construct
  • Table-Valued Functions
  • Extended Events
  • Refactoring Requirements
  • XML Data

Useful for hiring

  • SQL server 2012 developer
  • SQL Server Developer
  • MS SQL Server developer
  • Database Application Developer

Start hiring job-fit candidates using this assessment

GET A DEMO

"We realized that to acquire quality talent, our recruitment process was in dire need of automation. Too many of our technicalteam were simply wasting hours conducting interviews that did not yield the desired results. For us the foremost criteria were to finda recruitment partner who could tick all the right boxes"

Rehana Nisar, Gartner,
Global Product & Services Recruitment Head
Question

The minimum and maximum value that DATEDIFF function can return is:

Answer
    • -2,147,483,648 and +2,147,483,647

    • -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807

    • -2,147,483,648 and 9,223,372,036,854,775,807

Question

Which code will give an error?

1 -SELECT DATEDIFF_BIG(MILLISECOND,
 '12/01/2015','12/30/2015') 
AS 'Difference in MILLISECOND'

2- SELECT DATEDIFF(MILLISECOND,
 '12/01/2015','12/30/2015')
 AS 'Difference in MILLISECOND'

Answer
    • 1

    • 2

    • 1,2

Question

How to replace NULL by 0 in the dynamic PIVOT query result?

Answer
    • DECLARE @DynamicPivotQuery AS NVARCHAR(max) 
      DECLARE @ColumnName AS NVARCHAR(max) 

      --Get distinct values of the PIVOT Column 
      SELECT @ColumnName = Isnull(@ColumnName + ',', '') 
                           + Quotename(course) 
      FROM   (SELECT DISTINCT course 
              FROM   #coursesales) AS Courses 

      --Prepare the PIVOT query using the dynamic 
      SET @DynamicPivotQuery = N'SELECT Year, ' + @ColumnName 
                               + '  FROM #CourseSales  PIVOT(SUM(Earning)  FOR Course IN (' + @ColumnName 
                               + ')) AS PVTTable' 

      --Execute the Dynamic Pivot Query 
      EXEC Sp_executesql 
        @DynamicPivotQuery 

      go 

    • DECLARE @DynamicPivotQuery      AS NVARCHAR(max), 
              @PivotColumnNames       AS NVARCHAR(max), 
              @PivotSelectColumnNames AS NVARCHAR(max) 

      --Get distinct values of the PIVOT Column 
      SELECT @PivotColumnNames = Isnull(@PivotColumnNames + ',', '') 
                                 + Quotename(course) 
      FROM   (SELECT DISTINCT course 
              FROM   #coursesales) AS Courses 

      --Get distinct values of the PIVOT Column with isnull 
      SELECT @PivotSelectColumnNames  = Isnull(@PivotSelectColumnNames + ',', '')
                                         + 'ISNULL(' + Quotename(course) + ', 0) AS '
                                         + Quotename(course) 
      FROM   (SELECT DISTINCT course 
              FROM   #coursesales) AS Courses 

      --Prepare the PIVOT query using the dynamic 
      SET @DynamicPivotQuery = N'SELECT Year, ' + @PivotSelectColumnNames 
                               + ' FROM #CourseSales PIVOT(SUM(Earning) FOR Course IN (' + @PivotColumnNames 
                               + ')) AS PVTTable' 

      --Execute the Dynamic Pivot Query 
      EXEC Sp_executesql 
        @DynamicPivotQuery

    • DECLARE @DynamicPivotQuery      AS NVARCHAR(max), 
              @PivotColumnNames       AS NVARCHAR(max), 
              @PivotSelectColumnNames AS NVARCHAR(max) 
      DECLARE @DynamicPivotQuery AS NVARCHAR(max) 
      DECLARE @ColumnName AS NVARCHAR(max) 

      --Get distinct values of the PIVOT Column 
      SELECT @ColumnName = Isnull(@ColumnName + ',', '') 
                           + Quotename(course) 
      FROM   (SELECT DISTINCT course 
              FROM   #coursesales) AS Courses 

      --Prepare the PIVOT query using the dynamic 
      SET @DynamicPivotQuery = N'SELECT Year, ' + @ColumnName 
                               + ' FROM #CourseSales FOR Course IN (' + @ColumnName 
                               + ')) AS PVTTable' 

      --Execute the Dynamic Pivot Query 
      EXEC Sp_executesql 
        @DynamicPivotQuery 

      go 

Good News! You can customize this test as per your requirement

  • Choose and add questions from Interview Mocha question libraries

  • Add your own set of questions

  • Customize test settings like duration, number of questions, passing score, web proctoring and much more

  • Mail us at support@interviewmocha.com to create a custom test

Looking for a tailor-made test, to suit your assessment needs?

Get in touch

Global companies using Mocha assessments

  • altran
  • credit suisse
  • sephora
  • nielsen
  • capgemini
  • akamai

How Mocha assessments are brewed

Speed up your IT recruitment with Interview Mocha

  • 500+ IT skill tests
  • 20+ coding languages
  • 50+ domain knowledge tests
  • 100+ digital 2.0 skill tests
  • Customer focus aptitude tests
  • Enterprise ready features & more...
GET A DEMO

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates

GET A DEMO