Primary 3 Exam  >  Primary 3 Tests  >  Test: HTML JavaScript - Primary 3 MCQ

Test: HTML JavaScript - Primary 3 MCQ


Test Description

15 Questions MCQ Test - Test: HTML JavaScript

Test: HTML JavaScript for Primary 3 2024 is part of Primary 3 preparation. The Test: HTML JavaScript questions and answers have been prepared according to the Primary 3 exam syllabus.The Test: HTML JavaScript MCQs are made for Primary 3 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: HTML JavaScript below.
Solutions of Test: HTML JavaScript questions in English are available as part of our course for Primary 3 & Test: HTML JavaScript solutions in Hindi for Primary 3 course. Download more important topics, notes, lectures and mock test series for Primary 3 Exam by signing up for free. Attempt Test: HTML JavaScript | 15 questions in 15 minutes | Mock test for Primary 3 preparation | Free important questions MCQ to study for Primary 3 Exam | Download free PDF with solutions
Test: HTML JavaScript - Question 1

Which of the following is correct about JavaScript?

Detailed Solution for Test: HTML JavaScript - Question 1

Although JavaScript is not an OOP (Object-Oriented Programming) language like Java or PHP, it is an object-oriented language. The standard threesome of polymorphism, encapsulation, and inheritance are the criteria for object orientation, and JavaScript fails to meet them.

Test: HTML JavaScript - Question 2

What will be the output of the following JavaScript code snippet?
<p id="demo"></p>
var txt1 = "Sanfoundry_";
var txt2 = "Javascriptmcq";
document.getElementById("demo").innerHTML = txt1 + txt2;

Detailed Solution for Test: HTML JavaScript - Question 2

The + operator in javascript acts as a concatenation operator when used with string. The new string does not have any space between the two added strings.

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: HTML JavaScript - Question 3

Arrays in JavaScript are defined by which of the following statements?

Detailed Solution for Test: HTML JavaScript - Question 3

An array in JavaScript is an ordered list of values, each value is referred to as an element, and it is identified by an index. An array can include values of many sorts and the length of an array dynamically sized.

Test: HTML JavaScript - Question 4

What will be the output of the following JavaScript code snippet?

// JavaScript Equalto Operators
function equalto()
{
    int num=10;
    if(num===”10”)
        return true;
    else
        return false;
}

Detailed Solution for Test: HTML JavaScript - Question 4

A === operator in JS is only true if the operands are of the same type and the contents match. Two strings are strictly equal when they have the same sequence of characters, same length, and same characters in corresponding positions.

Test: HTML JavaScript - Question 5

Which of the following is not javascript data types?

Detailed Solution for Test: HTML JavaScript - Question 5

JavaScript is a dynamic, loosely typed language. Variables in JavaScript aren’t tied to any specific value type, and each variable can be assigned and reassigned to values of all the types.

Test: HTML JavaScript - Question 6

What will be the output of the following JavaScript code snippet?
int a=1;
if(a!=null) // JavaScript not equal to Operators
    return 1;
else
    return 0;

Detailed Solution for Test: HTML JavaScript - Question 6

!= is not equal to the operator in Javascript. It gives a value of 1 if the two values which are compared are not equal and give 0 if the two values are equal.

Test: HTML JavaScript - Question 7

What will be the output of the following JavaScript program?
function sanfoundry(javascript)
{
    return (javascript ?  “yes” :  “no”);
}
    bool ans=true;
console.log(sanfoundry(ans));

Detailed Solution for Test: HTML JavaScript - Question 7

In javascript, “?” is called the ternary operator which is used for choosing one choice from the given two choices. It is used instead of if else statement and makes the code shorter.

Test: HTML JavaScript - Question 8

Which of the following can be used to call a JavaScript Code Snippet?

Detailed Solution for Test: HTML JavaScript - Question 8

A function call to the element on which JavaScript is to be run can be used to invoke JavaScript code. Other techniques include onclick, onload, and onsubmit, among others.

Test: HTML JavaScript - Question 9

What will be the output of the following JavaScript code?

var a=5 , b=1
var obj = { a : 10 }
// with keyword in JavaScript
with(obj)
{
      alert(b)
}

Detailed Solution for Test: HTML JavaScript - Question 9

Firstly the interpreter checks obj for property b. But it doesn’t find any property b so it takes the value from outside the object within the JavaScript code snippet.

Test: HTML JavaScript - Question 10

Which is a more efficient JavaScript code snippet?
Code 1 :

// for loop in javascript
for(var num=10;num>=1;num--)
{
           document.writeln(num);
}
Code 2 :

var num=10;
while(num>=1)
{
       document.writeln(num);
       num++;
}

Detailed Solution for Test: HTML JavaScript - Question 10

Code 1 would be more efficient JS code. Infact second code will go into runtime error as the value of num will never reach less than or equal to one.

Test: HTML JavaScript - Question 11

What happens in the following JavaScript code snippet?

var js = 0;
while (js < 10) 
{
     console.log(js);
     js++;
}

Detailed Solution for Test: HTML JavaScript - Question 11

In JavaScript, Console.log is a predefined function that accepts the value as an argument. At the time of code execution, console.log prints this value in the argument to the console.

Test: HTML JavaScript - Question 12

Which of the following scoping type does JavaScript use?

Detailed Solution for Test: HTML JavaScript - Question 12

JavaScript, like most current programming languages, employs lexical scoping. This means that functions are performed with the variable scope in effect when they were defined, rather than the variable scope in effect when they are invoked.

Test: HTML JavaScript - Question 13

What will be the output of the following JavaScript code?

var quiz=[1,2,3];  
var js=[6,7,8];  
var result=quiz.concat(js);  
document.writeln(result);

Detailed Solution for Test: HTML JavaScript - Question 13

Concat is a predefined function in the array library in Javascript. The concat function is used to combine the value of two arrays.
i.e.1, 2, 3, 6, 7, 8

Test: HTML JavaScript - Question 14

What will be the function of the following JavaScript program?

var scope = "js scope";
function checkscope() 
{
    var scope = "javascript scope"; 
    function f() 
    { 
         return scope; 
    }
    return f;
}

Detailed Solution for Test: HTML JavaScript - Question 14

The Lexical Environment is an object that is connected with every executing function, code block, and the script as a whole in JavaScript. The value in scope is returned by the code snippet above.

Test: HTML JavaScript - Question 15

Which of the following methods/operation does javascript use instead of == and !=?

Detailed Solution for Test: HTML JavaScript - Question 15

The comma operator, bitwise operators, and the ++ and — operators are not included in the subset. It also forbids the usage of == and!= due to the type conversion they do, instead requiring the use of === and!==.

Information about Test: HTML JavaScript Page
In this test you can find the Exam questions for Test: HTML JavaScript solved & explained in the simplest way possible. Besides giving Questions and answers for Test: HTML JavaScript, EduRev gives you an ample number of Online tests for practice

Top Courses for Primary 3

Download as PDF

Top Courses for Primary 3