From a21f05c70edfb572907a81235ea06a6572424172 Mon Sep 17 00:00:00 2001 From: sandeep972 Date: Sat, 23 Mar 2019 14:17:42 +0530 Subject: [PATCH 1/6] fixed in numerical approximation.js --- src/lab/exp1/simulation/numericalApproximation.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lab/exp1/simulation/numericalApproximation.js b/src/lab/exp1/simulation/numericalApproximation.js index 5ca76384..25742c21 100644 --- a/src/lab/exp1/simulation/numericalApproximation.js +++ b/src/lab/exp1/simulation/numericalApproximation.js @@ -294,6 +294,10 @@ window.view = { alert('Integration Limits are from 0 to 30, b > a and b-a >= 1'); return false; } + else if (valueA2 < 0 || valueB2 < 0 ){ + alert('Integration Limits are from 0 to 30, b > a and b-a >=1'); + return false; + } else { model.inputValueA = valueA2; model.inputValueB = valueB2; From 2ae3bde44e289b58281ec04468fb79ce373b27f3 Mon Sep 17 00:00:00 2001 From: sandeep972 Date: Sat, 23 Mar 2019 15:08:23 +0530 Subject: [PATCH 2/6] fixed in stringMatching.js --- .../StringMatching/stringMatching.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/lab/exp7/simulation/StringMatching/stringMatching.js b/src/lab/exp7/simulation/StringMatching/stringMatching.js index 12fc1195..831ffae2 100644 --- a/src/lab/exp7/simulation/StringMatching/stringMatching.js +++ b/src/lab/exp7/simulation/StringMatching/stringMatching.js @@ -104,6 +104,33 @@ window.view = { alert('Maximum String Size allowed is Seven, Minimum Size is One and size of str2 should be less than equal to size of str1'); return false; } + else{ + var i=0; + var j=0; + var k=0; + for(i=0 ; i < model.inputString1.length ; i++){ + if( model.inputString1[i] == ' '){ + j=1; + } + } + for(i=0; i < model.inputString2.length ; i++){ + if(model.inputString2[i]== ' '){ + k=1; + } + } + if(j==1 && k==1){ + alert("Input the strings with no spaces in it"); + return false; + } + else if(j==1 && k==0){ + alert("Input the string str1 with no spaces in it"); + return false; + } + else if(j==0 && k==1){ + alert("Input the string str2 with no spaces in it"); + return false; + } + } this.changePropertyOfElements(); this.resetStrings(); this.resetTable(); From 16b15f4d0b66916ff1df3fba224a83b52217c496 Mon Sep 17 00:00:00 2001 From: sandeep972 Date: Sat, 23 Mar 2019 15:27:33 +0530 Subject: [PATCH 3/6] fixed in basicControlFlow.js --- .../exp6/simulation/SwitchCase/basicControlFlow.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js index 6822a81c..d7c6ddfe 100644 --- a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js +++ b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js @@ -131,15 +131,19 @@ window.view = { then make submit button disable and make start button enable. */ validationInput: function () { var textFieldValue = this.getValue('textFieldId'); - if (textFieldValue === '' || isNaN(textFieldValue)) { - alert('Enter Numeric Values Only'); + if (textFieldValue === '' || isNaN(textFieldValue)){ + alert('Enter Numeric Values Only'); + return false; + } + else if(Number(textFieldValue) <= 0 || Number(textFieldValue) > 7){ + alert("Enter the numbers in the interval [1,7]"); return false; - } + } else { this.changePropertyOfElements(); model.inputNumber = Number(textFieldValue); this.setInnerHtml('idOfDay', model.inputNumber); - } + } }, // changePropertyOfElements: changes property of elemants with enableElement, disableElement and changeClass. changePropertyOfElements: function () { From ff317c7055f99e920ca241ce7ced8085725a2c3a Mon Sep 17 00:00:00 2001 From: sandeep972 Date: Mon, 25 Mar 2019 23:09:26 +0530 Subject: [PATCH 4/6] fixed in the basiccontrolflow.js in the exp6 --- .../simulation/SwitchCase/basicControlFlow.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js index d7c6ddfe..a6112226 100644 --- a/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js +++ b/src/lab/exp6/simulation/SwitchCase/basicControlFlow.js @@ -6,7 +6,7 @@ window.model = { inputNumber: 0, //user input text field. } - +var x; window.view = { currentSiblingElement: new Object(), // Object value of current sibling. nextSiblingElement: new Object(), // Object value of next sibling. @@ -24,11 +24,21 @@ window.view = { this.addClickEvent('radioBtn5Id', function() { view.setValue('textFieldId', this.value) }); this.addClickEvent('radioBtn6Id', function() { view.setValue('textFieldId', this.value) }); this.addClickEvent('radioBtn7Id', function() { view.setValue('textFieldId', this.value) }); + this.addClickEvent('radioBtn1Id', function() { view.setValu('radioBtn1Id') }); + this.addClickEvent('radioBtn2Id', function() { view.setValu('radioBtn2Id') }); + this.addClickEvent('radioBtn3Id', function() { view.setValu('radioBtn3Id') }); + this.addClickEvent('radioBtn4Id', function() { view.setValu('radioBtn4Id') }); + this.addClickEvent('radioBtn5Id', function() { view.setValu('radioBtn5Id') }); + this.addClickEvent('radioBtn6Id', function() { view.setValu('radioBtn6Id') }); + this.addClickEvent('radioBtn7Id', function() { view.setValu('radioBtn7Id') }); this.addClickEvent('submitBtnId', function() { view.validationInput() }); this.addClickEvent('startBtnId', function() { view.startStepExecution() }); this.addClickEvent('nextBtnId', function() { view.showDayOfWeek() }); this.addClickEvent('resetBtnId', function() { view.resetButtonSwitch() }); }, + setValu: function (id){ + x=document.getElementById(id).value; + }, // setInnerHtml: set innerText to a element. setInnerHtml: function (id, innerHTML) { document.getElementById(id).innerHTML = innerHTML; @@ -135,6 +145,10 @@ window.view = { alert('Enter Numeric Values Only'); return false; } + else if( textFieldValue != x){ + alert("enter the value same in the text box as the option selected in the radio buttons"); + return false; + } else if(Number(textFieldValue) <= 0 || Number(textFieldValue) > 7){ alert("Enter the numbers in the interval [1,7]"); return false; From 8e8bccb8ff0348f66d46bc639bba3369916a4502 Mon Sep 17 00:00:00 2001 From: sandeep972 Date: Tue, 26 Mar 2019 00:30:42 +0530 Subject: [PATCH 5/6] fixed in exp9 in quiz.html --- src/lab/exp9/quiz.html | 45 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/lab/exp9/quiz.html b/src/lab/exp9/quiz.html index c66878ee..f7334caf 100644 --- a/src/lab/exp9/quiz.html +++ b/src/lab/exp9/quiz.html @@ -20,7 +20,14 @@ body{ background-color: #f4f4f4; } - + + @@ -68,14 +75,14 @@ printf(" * "); } -a. n
-b. n^2
-c. n(n-1)/2
-d. n(n+1)/2
+a. n
+b. n^2
+c. n(n-1)/2
+d. n(n+1)/2>

  • For every recursive solution, there is a corresponding iterative solution
  • -a. True
    -b. False
    +a. True
    +b. False

  • What will be the ouptut of the following function call: fun2(20); where fun2 is defined as:
  • @@ -88,10 +95,10 @@
           printf("%d ", n);
         }
         
    -a. 20 40 60 80 60 40 20
    -b. 80 60 40 20
    -c. 20 40 60 80 80 60 40 20
    -d. 20 40 60 80
    +a. 20 40 60 80 60 40 20
    +b. 80 60 40 20
    +c. 20 40 60 80 80 60 40 20
    +d. 20 40 60 80

  • What will be the ouptut of the following function call: fun3(100); where fun3 is defined as:
  • @@ -103,10 +110,10 @@
              return 1 + fun1(n/2);
         }
         
    -a. 6
    -b. 7
    -c. 5
    -d. 4
    +a. 6
    +b. 7
    +c. 5
    +d. 4

  • What will be the ouptut of the following function call: fun4(4,3); where fun4 is defined as:
  • @@ -118,10 +125,10 @@
             return fun1(x - 1,  x + y);
         }
         
    -a. 13
    -b. 14
    -c. 3
    -d. 7
    +a. 13
    +b. 14
    +c. 3
    +d. 7

  • A recursive function must necessarily make a call to
  • A is required so that there is no infinite recursive calling of the same function.


  • From 5652e3fd57e2c0d790927992798e3b1f5a94572e Mon Sep 17 00:00:00 2001 From: sandeep972 Date: Tue, 26 Mar 2019 09:39:13 +0530 Subject: [PATCH 6/6] fixed in experiment 2/simulation/function.js --- src/lab/bstyle.css | 1 - src/lab/exp2/simulation/function.js | 24 ++++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/lab/bstyle.css b/src/lab/bstyle.css index f289b42a..97272685 100644 --- a/src/lab/bstyle.css +++ b/src/lab/bstyle.css @@ -76,7 +76,6 @@ border-color: #e7e7e7; .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>li>a{ /*.navbar-default .navbar-nav>.active>a:hover, .navbar-default .navbar-nav>.active>a:focus {*/ color: #fff; -background: #3652a4; } @media (max-width: 480px) { diff --git a/src/lab/exp2/simulation/function.js b/src/lab/exp2/simulation/function.js index 9d494050..64de5223 100644 --- a/src/lab/exp2/simulation/function.js +++ b/src/lab/exp2/simulation/function.js @@ -141,10 +141,8 @@ window.view = { } if ( a !== '1') alert('Incorrect value of input variables(arguments). Calculating the area of a square only requires the length of the side of the square. Try again.') - else if ( b !== 'float' ) - alert('Incorrect datatype of input variables(arguments). The value of the side of a square need not be an integer. Try again.') - else if ( c !== 'float' ) - alert('Incorrect datatype for return type. The value of the area of a square need not be an integer. Try again.') + else if( b != 'int' && c == 'int') + alert('Incorrect data types'); else if ( d !== 'a*a' ) alert('Incorrect formula for calculating the area of a square. Try again.') else @@ -179,10 +177,8 @@ window.view = { } if ( a !== '2') alert('Incorrect value of input variables(arguments). Calculating the area of a rectangle requires the length of the two different parallel sides of the rectangle. Try again.') - else if ( b !== 'float' ) - alert('Incorrect datatype of input variables(arguments). The value of the sides of a rectangle need not be integers. Try again.') - else if ( c !== 'float' ) - alert('Incorrect datatype for return type. The value of the area of a rectangle need not be an integer. Try again.') + else if( b != 'int' && c == 'int') + alert('Incorrect data types'); else if ( d !== 'a*b' ) alert('Incorrect formula for calculating the area of a rectangle. Try again.') else @@ -217,10 +213,8 @@ window.view = { } if ( a !== '1') alert('Incorrect value of input variables(arguments). Calculating the area of an equilateral triangle only requires the length of one of the sides of the triangle. Try again.') - else if ( b !== 'float' ) - alert('Incorrect datatype of input variables(arguments). The value of the side of an equilateral triangle need not be an integer. Try again.') - else if ( c !== 'float' ) - alert('Incorrect datatype for return type. The value of the area of an equilateral triangle need not be an integer. Try again.') + else if( b != 'int' && c == 'int') + alert('Incorrect data types'); else if ( d !== 'correct' ) alert('Incorrect formula for calculating the area of an equilateral triangle. Try again.') else @@ -255,10 +249,8 @@ window.view = { } if ( a !== '1') alert('Incorrect value of input variables(arguments). Calculating the area of circle only requires the radius. Try again.') - else if ( b !== 'float' ) - alert('Incorrect datatype of input variables(arguments). The value of the radius of the circle need not be an integer. Try again.') - else if ( c !== 'float' ) - alert('Incorrect datatype for return type. The value of the area of the circle need not be an integer. Try again.') + else if( b != 'int' && c == 'int') + alert('Incorrect data types'); else if ( d !== 'pi*a*a' ) alert('Incorrect formula for calculating the area of the circle. Try again.') else