Web Application Development with JavaScript MongoDB | Week 1

Web Application Development with JavaScript MongoDB Week 1 Coursera Solution

Link : https://www.coursera.org/learn/web-application-development

Graded Quiz

1. When does the function passed to Meteor.startup run?

When the client connects for the first time.

Whenever the Meteor server is started up.

When the template starts being rendered.

When the database connection is available.

2. What does the following code pass to the template helper if there are no items in the Documents collection?

  doc = Documents.findOne();
  if (!doc){
    return {"title":"nothing to see here"};
  } else {
    return doc;

An object with an automatic _id field and a title field



An object with a title field

3. In which of the following cases will the datedisplay template periodically re-render itself?

  Session.set("date", new Date());
}, 1000);
    return Session.get("date");

4. Which of the following are reactive data sources? (Select all that apply)

New Mongo.Collection("comments");

5. Which of the following creates a collection which will be visible inside Mongo as ‘films’ and inserts something into it when the server starts up?

Films = new Mongo.Collection("films");
//code to run on server at startup
  Films.insert({"title":"sun wars 25"});

6. You see a variable declaration as follows:

 var global_var = true;

Where can this variable be seen?

In templates

In the Mongo shell

In other js files inside the app folder

In template helpers in the same js file as this line.

7. Look up the sharejs package for Meteor. Find the mizzao github page. Who is the first of the list of contributors at the bottom of the page?

Karan Batra-Daitch

Matthew Yee-King

Andrew Mao

CJ Carr

8. Locate and look in a Bootstrap.css file. Which of the following navbar related classes are in the Bootstrap css file? Select all that apply.





9. Why did I use an iframe to wrap the preview pane instead of a div?

div tags would clash with the Bootstrap library.

You can dynamically change the content in an iframe but not a div.

An iframe is more interactive than a div.

An iframe contains a complete HTML document, meaning the user can code up a complete HTML document in the editor pane, and it will display as expected in the viewer pane.

More on Web Application Development with JavaScript MongoDB


The content uploaded on this website is for reference purposes only. Please do it yourself first.