SitePoint Sponsor

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 25 of 67
  1. #1
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,499
    Mentioned
    944 Post(s)
    Tagged
    14 Thread(s)

    We Need Quiz Questions for Our New Site - QuizPoint

    One of our recent Triple Time creations is a fun little project called Quizpoint - a quiz site for web geeks.

    In order to keep the site entertaining and challenging, we need as many questions as we can source, which is where you guys come in.

    We're looking for JavaScript, Ruby and WordPress questions of all difficulty levels. If you can think of any, post them in this thread, along with the answer and we'll put them up on the site.

    While you're at it, check Quizpoint out and see just how smart you are!

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    This is a fun idea! I've already tried a quiz, and it was fun.

    Here's a simple JS one:

    When linking to a script, which of these is the best option for the type attribute?

    type="javascript"

    type="script"

    type="text/javascript"

    These days, you don't need it at all
    Answer: These days, you don't need it at all
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Another JS one:

    Which of these is NOT a valid comment in JavaScript:

    // This is a comment.

    /* This is a comment. */

    /* This is a comment.

    <!-- This is a comment.
    Answer:

    /* This is a comment
    Last edited by ralph.m; Dec 10, 2012 at 17:51. Reason: ammemded option 4 to <!--
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Another JS question:

    Which statement best explains what "unobtrusive JavaScript" is?

    JavaScript that doesn't annoy users

    JavaScript that is separate from HTML

    JavaScript that does not affect a web page

    JavaScript that works even with scripting turned off
    Answer: JavaScript that is separate from HTML
    Last edited by ralph.m; Dec 3, 2012 at 20:36.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Another JS one (might need to be checked/re-phrased by a JS expert, though, like those above):

    Given an element assigned to a variable "child", which of the following could be used as part of a script to remove the padding on the child's parent element?

    child[i].parentNode.style.padding = "0";

    child.parentNode.style.padding = "0";

    child[i].parentNode.padding = "0";

    child.parentNode.style.padding = none;
    Answer: child[i].parentNode.style.padding = "0";

    (Comment: You can't use child.parentNode since the child element will be a NodeList, not a single Node—even if there is only one such child element in the document.)
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Another JS question:

    How will the following code be output?

    var text = "Statement one
    Statement two
    Statement three";
    console.log(text);


    Uncaught Syntax Error: Unexpected token ILLEGAL

    Statement one
    Statement two
    Statement three

    Statement oneStatement twoStatement three

    Statement one Statement two Statement three
    Answer: Uncaught Syntax Error: Unexpected token ILLEGAL

    Explanation: You cannot create a string that spans multiple lines in JavaScript.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    JS question:

    How will the following code be output?

    var hello = "Hi There!";
    var test = hello.indexOf("there");
    console.log(test);


    3

    Undefined

    -1

    4
    Answer: -1
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    JS question:

    If this code were run, what value would be output for the variable "name"?
    var name;



    null

    undefined

    0

    name
    Answer: undefined
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  9. #9
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,272
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by ralph
    <! This is a comment.
    Huh, learned something new. I wondered where MS got that syntax from for their CC's.

    Re #7:
    var test = hello.indexOf("there");
    This is one of those questions where you'd have to be aware of the people you're sending it to. IndexOf isn't built into IE and developers who build for the practical web either don't use it, have built their own (or used Mozilla's), or would wonder if the expected answer assumes all relevant interpreters can read that and the issue is the capitalisation.

    These are some good Javascript questions, but I dunno where you'll get the Ruby ones.

  10. #10
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Off Topic:

    Quote Originally Posted by Stomme poes View Post
    IndexOf isn't built into IE ...
    Sigh ... wouldn't ya know? (I'm just learning about it.)
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  11. #11
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Found a question with an incorrect answer. It was about the nth-child selector, with 3n+1. It claimed the answer was 'The first row, then every fourth row' which is wrong. 'Every third row' is the most accurate there, but it said that was incorrect.

  12. #12
    SitePoint Wizard masm50's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    2,508
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Slightly off topic - but what did you use to build Quizpoint? Did you base it on any CMS or build it in house completely?

  13. #13
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    The site doesn't function without JavaScript. You just see a nice "loading..." text and even the site feedback won't work without JavaScript so I'll give the feedback here instead.

  14. #14
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Another JS one (might need to be checked/re-phrased by a JS expert, though, like those above):

    Answer: child[i].parentNode.style.padding = "0";

    (Comment: You can't use child.parentNode since the child element will be a NodeList, not a single Node—even if there is only one such child element in the document.)
    This probably depends on how you get the contents of "child" - if we take the question literally then child.parentNode would be acceptable to access it because "child" is an element. For example document.getElementById() and document.querySelector() return references to an element rather than a node list. An example snippet might be helpful to qualify the question:
    Code:
    var child = document.getElementById("content").children;
    Quote Originally Posted by Stomme poes View Post
    Re #7:
    This is one of those questions where you'd have to be aware of the people you're sending it to. IndexOf isn't built into IE and developers who build for the practical web either don't use it, have built their own (or used Mozilla's), or would wonder if the expected answer assumes all relevant interpreters can read that and the issue is the capitalisation.
    It's only .indexOf() on Arrays that isn't present in < IE9. (.indexOf() on strings has been part of the language spec for a lot longer and should be present in older Internet Explorers )
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  15. #15
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Regarding the type= question for JavaScript perhaps a better one would be to ask what the standard specifies is the correct type to use when you do specify it.

    The answer is of course type="application/javascript" since text/javascript was deprecated many years ago and only needs to be used in pages where you want to allow the code to be run as jScript where the browser doesn't support JavaScript - for example in IE8.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  16. #16
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by AussieJohn View Post
    This probably depends on how you get the contents of "child"
    I suspect someone is getting var child; and document.getElementById('something').child mixed up - the latter is a nodelist but the first is just a variable that can have any value assigned to it. One example of where using variable names that match the names of DOM elewments can make things confusing.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  17. #17
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Off Topic:

    Thanks, guys. My questions are just based on my noobie explorations into JS, so if they are wrong or faulty, please just rewrite them properly (and I'll remove mine) or suggest that they be deleted if they are not worth saving. You are the guys who should be writing these.

    Maybe @Pullo and @markbrown4 can come up with some Ruby questions.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  18. #18
    SitePoint Member James08's Avatar
    Join Date
    Dec 2012
    Posts
    0
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hi Stormrider,
    Nice find, seems someones made a typo.

    All fixed up!

    Thanks for your time

  19. #19
    SitePoint Member James08's Avatar
    Join Date
    Dec 2012
    Posts
    0
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xhtmlcoder View Post
    The site doesn't function without JavaScript. You just see a nice "loading..." text and even the site feedback won't work without JavaScript so I'll give the feedback here instead.
    Hi xhtmlcoder,
    Yes at the moment the site will only work with javascript, still in early stages of development

    Thanks for you time

  20. #20
    SitePoint Member James08's Avatar
    Join Date
    Dec 2012
    Posts
    0
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by masm50 View Post
    Slightly off topic - but what did you use to build Quizpoint? Did you base it on any CMS or build it in house completely?
    Hi masm50,
    All questions are welcome, trying to make as much of a fun learning experience as possible
    No, quizpoint isn't based on any CMS's its completely built in house, using backbone.js

    Thanks for your time, and using Quizpoint.com

  21. #21
    SitePoint Member James08's Avatar
    Join Date
    Dec 2012
    Posts
    0
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hi All some great discussions going on, getting some good questions!

    Keep them coming!

  22. #22
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,499
    Mentioned
    944 Post(s)
    Tagged
    14 Thread(s)
    In case anyone is wondering, @James08 ; is part of our grad program and has been tasked with the job of QuizPoint Product Manager. This thread was his idea, and I think it was a stroke of genius.

  23. #23
    SitePoint Enthusiast
    Join Date
    Jul 2012
    Posts
    32
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    CSS

    Q) How would you select a group of <p> tags which were preceded, somewhere in the element, by an <h1> tag?
    A) h1 p B) h1 ~ p C) h1 + p D p + h1

    Q) How would you select select all <a> tags containing an external link?
    A) a[href^="http"] B) a[href="http" C) a[href~="http"] D) a[href=external]

    Q) What selector would you use in order to create an anchor-based pure CSS accordion menu?
    A) a:hover B) a:visited C) a:clicked D) a:active

    Javascript:

    Q) What function would you use in order to create a clock?
    A) window.tick() B) delay() C) window.setInterval D) window.time.increment()

    Q) How would you check if a number is event?
    A) A) if (Math.round(x/2) == x/2) B) if (int x/2) C) if (!int(x/2)) D) if (Math.even(x/2))

    Q) What would be the most efficient method to create a grid in Javascript?
    A) while loops B) for loops C) double-value loop D) do loops

    Wordpress:

    Q) What is the first page in the stack for viewing a single post with an attachment?
    A) $subtype.php B) $type.php C) $mimetype.php D) $mimetype_$subtype.php

    Q) What recently launched feature for Wordpress that, among other things, adds in-house user tracking?
    A) Booster B) Analytical C) Wordpress Cloud D) Jetpack

    Q) What is the default URL structure of single posts?
    A) ./day/month/year B) ./post-title C)./year/month/day D) ./category/post-title/post-id

  24. #24
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    JavaScript scope is always a good thing to learn

    In the following example, what is the value of "x" in in the alerts?

    Code:
    var x = 10;
    
    function hello() {
        var x = 5;
        alert(x);
    }
    
    hello();
    
    alert(x);

    a) 10, 10
    b) 5, 5
    c) 5, 10
    d) 10, undefined
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  25. #25
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by AussieJohn View Post
    JavaScript scope is always a good thing to learn
    A nicely constructed question, John. I was musing on a concise example of this, but yours is perfect.

    @connor4312 ; Some nice questions there. What's the answer to the last one?
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •