Saturday, May 29, 2021

Node js Slip no.3



Software solutions

 SYBBA(CA) Practical Slips Solutions

Node JS

Slip No.3.Create a Node.js Application that uses user defined module circle.js which exports functions area() and circumference() and display details on console.

circle.js

var circle={  

  area: function(r)

{

    var pi=3.14,a;  

     a=pi*r*r;

  

  console.log('area of circle is:'+a);

},

circumference: function(r)

{

    var pi=3.14,c;

  c=2*pi*r;

  console.log('circumference of circle is:'+c);

}

};

 module.exports=circle


mycircle.js

var mymod=require('C:/Users/Public/node_prog/circle.js');

mymod.area(5);

mymod.circumference(5);


Initiate mycircle.js file :

C:\Users\Your Name>node mycircle.js



All software solutions

Node Js Slip no.2

SYBBA(CA) Practical Slips Solutions

Node JS

Slip No.2.Create a Node.js Application that uses user defined module to return the factorial of given number.

fact.js

var fact={  

  factorial: function(n)

{

    var f=1,i;

  for(i=1;i<=n;i++)

   {     f=f*i;

   }

  console.log('factorial of '+n+' is:'+f);}};

 module.exports=fact


app.js

var mymod=require('C:/Users/Public/node_prog/fact.js');

mymod.factorial(5);


Initiate app.js file :

C:\Users\Your Name>node app.js


Wednesday, May 19, 2021

Node js slip no 1

 SYBBA(CA) Sem IV  Node Js slips solutions

 Slip No 1

Q1. Create a Node.js file that will convert the output "Hello World!" into upper-case letters.


var http = require('http');

var uc = require('upper-case');

http.createServer(function (req, res) {

  res.writeHead(200, {'Content-Type': 'text/html'});

  res.write(uc.upperCase("Hello World!"));

  res.end();

}).listen(8080);


Save the code above in a file called "d_uppercase.js", and initiate the file:

First Install module 'upper-case' using npm

C:\Users\Your Name>npm install upper-case

Initiate d_uppercase:

C:\Users\Your Name>node d_uppercase.js

If you have followed the same steps on your computer, you will see the same result as the example: http://localhost:8080

Monday, September 21, 2020

Angular Js Slip no.5

 SYBBA(CA)

Angular Js BCA Practical Slips Solution

Slip no.5 Write an AngularJS script for addition of two numbers using ng-init, ng-model & ng-bind. And also Demonstrate ng-show, ng-disabled, ng-click directives on button component.

<!DOCTYPE html>

<html>

<head>

    <script src="C:\angular-1.8.0\angular-1.8.0\angular.js"></script>

</head>

<body  ng-app ng-init="checked=true;check=true" >


  Enter number1: <input type="number" ng-model="n1"><br/>

  <br/>

  Enter number2:<input type="number" ng-model="n2">

  <br/><br/>

  <button ng-click="add=(n1+n2)" ng-init="add=0">result </button><br/><br/>

   addition of two numbers= 

  <span ng-bind="add"></span><br/><br/>

  <label>Click me to make button disabled or enabled: <input type="checkbox" ng-model="checked"></label>

  <button  ng-disabled="checked" >Disable</button><br/><br/>

  <label>Click me to  show or hide button: <input type="checkbox" ng-model="check"></label> 

  <button   ng-show="check">Show</button><br/>


</body>

</html>

BCA Practical Slips

Friday, September 18, 2020

Angular Js Slip No.4

 SYBBA(CA)

Angular Js BCA Practical Slips Solution

Slip No.4 Write an AngularJS script to print details of bank (bank name, MICR code, IFC code, address etc.) in tabular form using ng-repeat 

 <!DOCTYPE html> 


<html> 

<script src= "C:\angular-1.8.0\angular-1.8.0\angular.js"> 

  </script> 

<style> 

    body { 

        margin: 2%; 

        font-size: 120%; 

    }       

    th, 

   td { 

        padding: 20px; 

    } 

</style> 

<body ng-app="myApp" ng-controller="ListController"> 

    <h1>Bank Details</h1> 

    <table border=1> 

        <thead> 

            <tr> 

                <th>S.No</th> 

                <th>Name</th> 

                <th>MICR Code</th> 

                <th>IFSC Code</th> 

                <th>Address</th> 

            </tr> 

        </thead> 

        <tr ng-repeat="i in bank"> 

            <td> {{i.sno}} </td> 

            <td> {{i.name}} </td> 

            <td> {{i.micr}} </td> 

            <td> {{i.ifsc}} </td> 

            <td> {{i.address}} </td> 

        </tr> 

    </table>   

</body> 

<script> 

    var app = angular.module('myApp', []); 

    app.controller( 

      'ListController', function($scope) { 

        $scope.bank = [{ 

                sno: 1, 

                name: 'SBI', 

                micr: 'sbi123', 

                ifsc: 9876563454, 

                address: "satara", 


            }, { 


                sno: 2, 

                name: 'BOI', 

                micr: 'boi123', 

                ifsc: 7865452396, 

                address: "Pune", 


            }, { 


                sno: 3, 

                name: 'RBI', 

                micr: 'rbi123', 

                ifsc: 7865452316, 

                address: "kolhapur", 


            }, { 


                sno: 4, 

                name: 'BOM', 

                micr: 'bom123', 

                ifsc: 7765458921, 

                address: "goa", 


            }, { 


                sno: 5, 

                name: 'BOB',          

               micr: 'bob123', 

                ifsc: 7765458921, 

                address: "satara", 

            } 

        ]; 

    }); 

</script> 

</html>