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?

Template.docList.helpers({document:function(){ 
  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

FALSE

Undefined

An object with a title field


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

Meteor.setInterval(function(){	
  Session.set("date", new Date());
}, 1000);
Template.datedisplay.helpers({	
  date:function(){	
    return Session.get("date");	
  }
})

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

Session
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
Meteor.startup(function(){  
  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.

navbar-fixed-bottom

navbar-fixed-top

navbar-collapse

navbar-header


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

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


* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first.