Programming Trivia Quiz Questions!

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Dkcrame
D
Dkcrame
Community Contributor
Quizzes Created: 1 | Total Attempts: 223
Questions: 10 | Attempts: 223

SettingsSettingsSettings
Programming Quizzes & Trivia

Questions and Answers
  • 1. 

    In the Invaders.js file there are a total of four functions. Which function moves each invader a step down when it gets to the boundary of the game area?

    • A.

      MoveInvadersDown()

    • B.

      MoveInvadersDown()

    • C.

      Moveinvadersdown()

    • D.

      MOVEINVADERSDOWN()

    Correct Answer
    A. MoveInvadersDown()
    Explanation
    The correct answer is "moveInvadersDown()". This function is likely the correct answer because it follows the standard naming convention for functions in JavaScript, which is camel case. The function name starts with a lowercase letter and each subsequent word is capitalized. Additionally, the function name accurately describes what it does, which is moving the invaders down when they reach the boundary of the game area.

    Rate this question:

  • 2. 

    In the file Main.js, there is a function that creates a new Invader. What is the name of the function?

    • A.

      Create

    • B.

      Add

    • C.

      Instantiate

    • D.

      Bench

    Correct Answer
    C. Instantiate
    Explanation
    The correct answer is "Instantiate". In the file Main.js, there is a function that creates a new Invader, and the name of that function is "Instantiate".

    Rate this question:

  • 3. 

    Here's a code fragment of a For loop. The For loop increments the variable called i. When the For loop ends what is the final value of i? Here's the code fragment: var i:int = 0; for(i = 0; i < 361; i++){      print("What's the final value of i?"); }

    Correct Answer
    360
    Explanation
    The final value of i is 360 because the for loop increments i by 1 each time it runs, starting from 0. The loop continues as long as i is less than 361. Since 360 is the last value of i that satisfies this condition, it is the final value of i when the loop ends.

    Rate this question:

  • 4. 

    In the file bullet.js there is a function there that causes the bullet to detect if it collides with something. When that function does trigger, where would the bullet be positioned? Phrase it like this "120 in z".

    Correct Answer
    1000 in x
    Explanation
    The bullet would be positioned at 1000 in the x-axis when the collision detection function triggers.

    Rate this question:

  • 5. 

    There is  a function in ship.js that runs when the ship object comes into being. That function runs which line?

    • A.

      Bullet.transform.position.x = 1000;

    • B.

      Bullet.Transform.Position.X = 100;

    • C.

      Bullet.transform.position.x = 100;

    • D.

      Bullet.transform.position.x = 10;

    Correct Answer
    A. Bullet.transform.position.x = 1000;
    Explanation
    The correct answer is bullet.transform.position.x = 1000; because the question states that there is a function in ship.js that runs when the ship object comes into being. Since the function is not specified in the question, we can assume that it is not relevant to determining the correct line. Therefore, we can focus on the lines provided and choose the one that sets the x position of the bullet transform to 1000.

    Rate this question:

  • 6. 

    In the file Main.js, there is  an unused function that you can delete. What's the name of the function?

    Correct Answer
    Update
    Explanation
    Functions do something. This one has a name but it doesn't actually DO anything. What's the EXACT name of the function, omit the word "function" and the parentheses.

    Rate this question:

  • 7. 

    In question number 6, I asked about an unused function. In Invader.js, which function is unused?

    Correct Answer
    Start
  • 8. 

    In the file bullet.js, I have two variables with two different variable types. Which of the following below is not one of them?

    • A.

      Boolean

    • B.

      Float

    • C.

      Int

    • D.

      String

    Correct Answer(s)
    C. Int
    D. String
    Explanation
    There's more than one answer...

    Rate this question:

  • 9. 

    In Invader.js there is a function there called OnTriggerEnter. It accepts a collision object which I have assigned to a variable called col. I can get the name of the collision object by calling this: col.gameObject.name So I'm looking for three collision objects in a series of if statements which are those names?

    • A.

      LeftBarrier

    • B.

      Bullet

    • C.

      RightBarrier

    • D.

      Bullet

    Correct Answer(s)
    A. LeftBarrier
    C. RightBarrier
    D. Bullet
    Explanation
    The correct answer is "leftBarrier", "rightBarrier", and "bullet". These are the names of the collision objects that the code is looking for in the series of if statements. The OnTriggerEnter function accepts a collision object named "col", and by calling "col.gameObject.name", we can retrieve the name of the collision object. The code is checking if the name of the collision object matches any of the three specified names: "leftBarrier", "rightBarrier", and "bullet".

    Rate this question:

  • 10. 

    Answer this: var x:int = 25; var y:int = 48; if(x + y < 74){      print("That's right."); }else{     print("That's wrong."); }

    Correct Answer(s)
    That's right.
    Explanation
    Type in the EXACT print out. That's without the print statement, the parentheses, and the double quotes... The exact phrase, capitalisation and punctuation.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 19, 2013
    Quiz Created by
    Dkcrame
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.