CS8073 - Assignment - II
CS8073 - Assignment - II
CS8073 - Assignment - II
Sonali
18ucse036
1) <script>
var http = new XMLHttpRequest();
http.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
http.open("GET", "books.xml", true);
http.send();
function myFunction(xml) {
var xmlDoc = xml.responseXML;
document.getElementById("demo").innerHTML =
xmlDoc.getElementsByTagName("title")[0].childNodes[0];
</script>
Answer:
var http = new XMLHttpRequest();
http.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
myFunction(this);
}
};
http.open("GET", "books.xml", true);
http.send();
function myFunction(xml)
{
var xmlDoc = xml.responseXML;
document.getElementById("demo").innerHTML =
xmlDoc?.getElementsByTagName("title")[0].childNodes[0];
}
Error:
Line 13 = } Line 12 = ?
2) newNode = xmlDoc.newElement("book");
x = xmlDoc.documentElement;
y = xmlDoc.getElementsByTagName("book")[3];
x.insertBefore(newNode,y);
Error:
Line 1:var,?
Line 2 :var,?
Line 3:var,?
3) x = xmlDoc.getElementsByTagName('title');
xlength = x.len;
for (i = 0; i <xLen; i++) {
txt += x[i].childNodes[0].nodeValue) + " ";
Answer
var x = xmlDoc.getElementsByTagName('title');
var xlength = x.len;
for (var i = 0; i <xlength; i++)
txt += (x[i].childNodes[0].nodeValue) + " ";
Error:
line 1 var
line 2 var
line 3 var, {
4) using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" +
"</book>"); // Save the document to a file.
doc.Save("data.xml");
}
}
Output:
<book genre=”novel” ISBN=”1-861001-57-5”>
<title>Pride And Prejudice</title>
</book>
5) using System;
using System.Threading.Tasks;
namespace TutlaneExamples{
class Program{
static void Main(string[] args){
Task t1 = new Task(PrintInfo);
t1.Run();
Console.WriteLine("Main Thread Completed");
Console.ReadLine();
}
static void PrintInfo(){
for(int i = 1; i <= 4; i++){
Console.WriteLine("i value: {0}", i);
}
Console.WriteLine("Child Thread Completed");
}
}
}
Output:
i value: 1
i value: 2
i value: 3
i value: 4
Child Thread Completed
Main Thread Completed
6) The data is stored in a Microsoft SQL Server database on a server named Admin and the Database name
is Diploma. You connect to Diploma by using Windows authentication mode.You use a SqlConnection
object to connect to the database. Then which is the correct connection string from below?
a) Data Source=Admin\SQLEXPRESS;Initial
Catalog=Diploma;Integrated Security=True
b) Data Source=Admin/SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=True
c) Data Source=Admin\SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=False
d) Data Source=Admin/SQLEXPRESS;Initial Catalog=Diploma;Integrated Security=False
Answer:
1) Data Tables
2) XAML
Answer:
Web Form iii. .aspx
Web User Control i.ascx
Web Service ii. .asmx