Few tricky Questions about SQL Server 2008 that I came across...

  • GilaMonster (1/10/2012)


    If I got those from a company prior to an interview, I would think twice (or more) about whether I wanted to work there. Whoever wrote those questions has no clue about SQL, they are so way wrong it's not even funny.

    Sounds like a bunch of questions coming from a recruiter.

    We could make them funny:-D

    No. Seriously, I would probably poke a lot of fun at them.:hehe:

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • brendan woulfe (1/10/2012)


    GilaMonster (1/10/2012)


    JagWalia (1/10/2012)


    Q. Which of the following statements can be used to provide sorted result set based in the CustomerName column?

    A. SELECT ROW_NUMBER() AS RN, CustomerName from Customers order by CustomerName

    B. SELECT ROW_NUMBER() OVER (ORDER BY CustomerName) AS RN, CustomerName FROM Customers

    C. SELECT ROW_NUMBER() (ORDER BY CustomerName) AS RN, from Customers

    D. SELECT ROW_NUMBER() AS RN, CustomerName from Customers[/quote-0]

    None of them.

    If that was a sample test or some training material that you bought, get a refund.

    Curious as to why you said none of them. The question is worded in a way that it can be read differently. I was thinking one of them is right though, without giving that one away.

    Yeah, that's what I was thinking. Just wanted to make sure it was the "sorted result" part of the question that lead her to say none of them is all.

  • @Craig: Answer A has an ORDER BY but invalid syntax.

    The problem in general from my point of view:

    There's a company looking for someone with decent SQL skills since they obviously don't have anybody at the team yet. Or they're trying to ask a bunch of trick questions just for the fun of it, and missed to include the fun part.

    But if you (JagWalia) cannot spot the errors in the questions/answers and provide a reason why those are wrong, you're probably not the one they're looking for. The company seems to look for someone to teach, not to learn...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • I am going to address these questions and answers to the employer. I had 39 questions and 33 out of those were correct, however these are the ones that caught me off guard. And I just want to make sure before addressing it to the employer.

  • LutzM (1/10/2012)


    @Craig: Answer A has an ORDER BY but invalid syntax.

    My foot tastes GREAT! I think I'll swallow to the knee next time.

    The problem in general from my point of view:

    There's a company looking for someone with decent SQL skills since they obviously don't have anybody at the team yet. Or they're trying to ask a bunch of trick questions just for the fun of it, and missed to include the fun part.

    But if you (JagWalia) cannot spot the errors in the questions/answers and provide a reason why those are wrong, you're probably not the one they're looking for. The company seems to look for someone to teach, not to learn...

    +1

    I'd definately have to agree with this. I wouldn't trust the rest of the questions offhand either.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • I have a question, where is this employer located? Notice, I'm not asking who they are, just where they are located.

  • these are an online assessment test questions called proveit

  • beginner_dk (3/18/2013)


    these are an online assessment test questions called proveit

    Yowch! You should alert the company that made you go through the "Proveit" gambit and then show them Gail's answers. As a bit of a side bar, this is why I refuse to go through such testing for any company.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I agree. They hired me anyway and I told them about it. Proveit needs to fix this mess otherwise it is hurting lots of people. I was lucky but not everybody.....

    Thanks

    Jag Walia

  • the company or the recruiter is unaware of the questions and the answers. He will just receive the score card with the percentile of the candidate.

  • Hi Everyone,

    I have few questions regards to Gila Monster's answers can anyone of you please help me in finding the right ones as i am new to SQL Server

    Q: Which of the following allows for the truncation of a transaction log?

    A. Transaction logs are truncated when you use SQL Profiler.

    B. Transaction logs are truncated when you use the following syntax: truncate table A

    C. Transaction logs are truncated when you backup your database.

    D. You can not backup transaction log.

    A: I guess C is a possible answer as the transactions logs are automatically truncated with back up

    Q: Which of the following statements about unique Constraints are TRUE?

    A. You can have only one unique constraint applied to a table.

    B. Unique constraints can be used to establish a link between two tables.

    C. You can only have one column assigned to a unique constraint.

    D. If a primary key was already assigned to a table, the unique constraint would identify a special column used for indexing,

    A: I am guessing B as the answer as "a link between tables" can also be a FK (FOREIGN KEY) and UC are used for FK's

    Q: Which of the following is an improved performance feature that uses bitmap filters for selecting minimal rows with queries?

    A. Table partitions

    B. Star Join

    C. Where clause

    D. Outer Join

    A: Star Join uses bitmap filters for performance in SQL SERVER 2008

    Q. Which of the following statements can be used to provide sorted result set based in the CustomerName column?

    A. SELECT ROW_NUMBER() AS RN, CustomerName from Customers order by CustomerName

    B. SELECT ROW_NUMBER() OVER (ORDER BY CustomerName) AS RN, CustomerName FROM Customers

    C. SELECT ROW_NUMBER() (ORDER BY CustomerName) AS RN, from Customers

    D. SELECT ROW_NUMBER() AS RN, CustomerName from Customers

    A: B as it is not mandatory to specify the partition by in over clause

    If PARTITION BY is not specified, the function treats all rows of the query result set as a single group.

    Q: Full text indexes can be backed up and restored with the rest of the database due to the ...

    A. ...new index organization system

    B. ...overall size of the index getting smaller.

    C. ...index becoming a part of the transaction logs.

    D. ...indexes no longer being stored outside of the database.

    A: D as coming from SQL SERVER 2008 Full text indexes are stored in databases unlike the previous versions where they are stored on disks structured outside the database

    Any Help is Greatly Appreciated!

    Thanks and Regards!

    🙂

  • beginner_dk (3/18/2013)


    the company or the recruiter is unaware of the questions and the answers. He will just receive the score card with the percentile of the candidate.

    That's actually a major part of the problem.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • beginner_dk (3/18/2013)


    A: I guess C is a possible answer as the transactions logs are automatically truncated with back up

    No they're not.

    A: I am guessing B as the answer as "a link between tables" can also be a FK (FOREIGN KEY) and UC are used for FK's

    They can be, but they're not required (either of the other 2 unique-guaranteeing structures is fine too). Still, a UQ does not in any way provide a link between tables, so no, B is wrong too.

    A: B as it is not mandatory to specify the partition by in over clause

    If PARTITION BY is not specified, the function treats all rows of the query result set as a single group.

    B does not necessarily provide an ordered resultset. It provides row numbers ordered by the customer name, the resultset however is not necessarily ordered that way. The only one that has an ORDER BY clause (required for guaranteeing an ordered resultset) has a syntax error.

    Don't confuse 'will usually work the way you want' with 'is guaranteed to work the way you want'. No order by clause, no guarantee of order.

    For B to be correct, it needs ORDER BY CustomerName added at the end.

    A: D as coming from SQL SERVER 2008 Full text indexes are stored in databases unlike the previous versions where they are stored on disks structured outside the database

    Outside the DB doesn't mean they're not backed up with the DB. Fulltext indexes have always been backed up with the DB, that they're now in the DB files doesn't suddenly change that.

    From Books Online (SQL 2005 entry)

    Backup and restore treat full-text catalogs the same as database files. If the database that is being copied contains tables that have been defined for full-text indexing, then the destination computer must also have Full-Text Search installed before the full-text catalogs can be re-created and repopulated. If the Microsoft Full-Text Engine for SQL Server (MSFTESQL) service is not installed, the full-text catalog will be offline after restore.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi GilaMonster,

    Thanks a lot for taking time to review them. The test says if you don't find correct answer in the given options, guess /choose the one which is more near to the correct answer and i was trying to do that. so it might help me if i had to take the test again.

    I went through few BOL topics (Transaction Log Truncation, Over Clause, Create Login, etc) and books to find these answers and thought they might be an option near to right one.

    Regarding sorting order, i went through the BOL over clause and tested on a table created my self and it worked. so i thought it might be true.

    Coming to full text indexes there is a book "Mastering SQL Server 2008 By Michael Lee, Gentry Bieker" on page 626, chapter 21, second para of the new alter feature box, it is stated that FTI's are backed up with every SQL Server Back up processes because they are included in the standard catalog

    so again with minimal knowledge about it, i assumed it to be true.

    your help is greatly appreciated and thanks for your tip Don't confuse 'will usually work the way you want' with 'is guaranteed to work the way you want'., will keep it in mind

    Thanks and Regards

    DK

  • beginner_dk (3/19/2013)


    Regarding sorting order, i went through the BOL over clause and tested on a table created my self and it worked. so i thought it might be true.

    "It worked for me once" != "It's guaranteed to work". No order by, no guarantee of order, end of story.

    Now, a simple query like that will probably come back in the correct order, but that's a side effect of how the query execution engine works, not a guaranteed behaviour

    Coming to full text indexes there is a book "Mastering SQL Server 2008 By Michael Lee, Gentry Bieker" on page 626, chapter 21, second para of the new alter feature box, it is stated that FTI's are backed up with every SQL Server Back up processes because they are included in the standard catalog

    so again with minimal knowledge about it, i assumed it to be true

    .

    It is true, but that quote in no way implies that prior to SQL 2008 FTIs were not backed up with the database because they're not included in the database.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 16 through 30 (of 36 total)

You must be logged in to reply to this topic. Login to reply