JavaScript for SEBA HSLC class 10

The following question are prepared on the base of HSLC final exam conducted by SEBA board of Assam. These questions comes under Computer Science.Its very necessary for an HSLC candidate to know how to prepare. And also necessary to know what will be  the pattern of the final question papers. That is why we are providing most important questions in an easy and suitable manner so that one can understand it easily, Read it  easily and the most important thing  is one can get it everywhere and any time whenever he or she needs.We are trying our label best to provide more and more but due to lack of fund,we are unable to take necessary actions. So if you are willing to support us financially, please Click here to Donate.Hopefully whole Assam will help us…

Q1.Factorial of any number in Javascript.


<!doctype html>
<html>
<head>
<script>
function show(){
var i, no, fact;
fact=1;
no=Number(document.getElementById("num").value);
for(i=1; i<=no; i++)
{
fact= fact*i;
}
document.getElementById("answer").value= fact;
}
</script>
</head>
<body>
Enter Num: <input id="num">
<button onclick="show()">Factorial</button>
<input id="answer">
</body>
</html>

Q2.Armstrong number in javascript.

<!doctype html>
<html>
<head>
<script>
function armstr()
{
var arm=0,a,b,c,d,num;
num=Number(document.getElementById("no_input").value);
temp=num;
while(temp>0)
{
a=temp%10;
temp=parseInt(temp/10); // convert float into Integer
arm=arm+a*a*a;
}
if(arm==num)
{
alert("Armstrong number");
}
else
{
alert("Not Armstrong number");
}
}
</script>
</head>
<body>
Enter any Number: <input id="no_input">
<button onclick="armstr()">Check</button></br></br>
</body>
</html>

Q 3.JavaScript program to convert lowercase letter into uppercase letter.


<!doctype html>
<html>
<head>
<script>
function myFunction() {
var str = "sebahelp";
var res = str.toUpperCase();
document.getElementById("demo").innerHTML = res;
}
</script>
</head>
<body>
<button onclick="myFunction()">Click Here for Convert String</button>
<p id="demo"></p>
</body>
</html>

Q 4. Print following pattern:

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5


<html>
<head>
<script type="text/javascript">
for(i=1; i <= 5; i++)
{
for(j=1; j<=i; j++)
{
document.write(j);
if(j == i)
continue;
else
document.write(' ');
}
document.write('<br />');
}

</script>
</head>
<body>
</body>
</html>

Q 5.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here