Saturday, 10 October 2015

23 - JSON Interview Questions

1.  What is the full form of JSON?
Ans Javascript Object Notation.

2.  What is JSON?
Ans. JSON is text-based human-readable data - interchange format.

3.  Who is the father of JSON?
Ans. Douglas Crockford.

4. How to parse JSON object to Javascript object?
Ans. Using Json.parse method

5. Name the browsers which support JSON.

Ans.  Firefox 3.5
         Chrome
         Opera 10
         Internet Explorer 8
         Safari

6. What is the MIME type of JSON?
Ans. "application/json"

7.  Which function is used to convert a JSON text into an Object?

Ans. eval() function

8. Which are the Data types supported by JSON?
Ans.  Number, String, Boolean, Array, Object, NULL

9.  What is JSON Parser?
Ans. JSON Parser is used to parse the JSON data into Objects.

10.  JSON Syntax.
Ans. JSON data is written as name/value pairs.
for Example : "Firstname" : "Sapna"

11. How to convert Javascript object to JSON?

Ans. JSON.stringify(Obj); method is used to convert javascript object to JSON.

12. List the benefits of JSON over XML.

Ans. It is faster & lighter than XML.
         XML data is all in the string while JSON can be interger, string, Array, Boolean

13. Which data types are used in JSON?
Ans. Number
         String
         Boolean
         Array
         Null
         Object

14. What is the file extension of the json file?
Ans. .json

15. Describe the syntax of JSON?
Ans.
       {
        "employee":
         [
         {"firstName": "Sapna" , "Department" : "Asp.net"},
         {"firstName": "Zia", "Department" : "Java" }
        ]
       }

16. Which function is used to convert JSON text into an object?
Ans. "eval"

17. What are the limitations of JSON?
Ans. JSON does not support comments
        It does not handle very complex data.
        It does not support multimedia formats like Images.

18. Is JSON programming language?
Ans. No JSON is not a programming language but it is the format to exchange data.

19. What is toJSON() method in JSON?
Ans. toJSON() method returns a string representation of Date object.

20. What is JSONP?
Ans. JSONP is the JSON with padding. JSONP sends data without any cross-domain issues.

21. What is JSON Viewer?
Ans. JSON Viewer represents data in more friendly manner.

22. What is the common use of JSON?
Ans. The common use of JSON is to exchange data from source to destination via API.

23. How to parse json in JQuery?
Ans. $json = '{"name":"Sapna","Designation":"Asp.Net Team Leader"}';
$obj = json_decode($json);
if(is_null($obj)) {
 die('Invalid JSON');
}


         

21 - Jquery Interview Questions

1. What is jQuery?
Ans. JQuery is a Lightweight Javascript Library.

2. What is the alias for jQuery?

Ans. dollar sign ($) is used as an alias in jQuery.

3.Types of selectors in jQuery.

Ans. 1. Class selectors
         2. ID selectors
         3. Element selectors

4. What are the slow selectors in jQuery?

Ans. Class selectors are slow compared to ID and Element.

5. Who is the founder of jQuery?

Ans. John Resig

6. What is the difference between Javascript and Jquery?

Ans. Javascript is the language and Jquery is the library built in the Javascript language.

7. How to check the data type of any variable in Jquery?

Ans. Using $.type(Object)

8. How to Hide Elements in Jquery?

Ans. Using hide()
         For Example : $("#ID").hide();

9. Is Jquery a W3C standard?

Ans. No

10. Which sign does Jquery use as a shortcut for Jquery?

Ans. $ sign.

11. List down Jquery effects methods.

Ans. Show()
         Hide()
         Toggle()
         FadeIn()
         FadeOut()

12. Which Jquery command used to check the version of Jquery?

Ans, $.ui.version

13. What is JQuery.noConflict?

Ans. JQuery.noConflict is used to overcome the conflicts between different JQuery frameworks.

14. What is the use of the JQuery.each() function?

Ans. JQuery.each() function is used to loop through the collection or array.

15. What is the use of the .first() function?

Ans. .first() function returns first element of the selected element.

16. What is the use of the .last() function?

Ans. .last() function returns last element of the selected element.

17. What is the use of the next() method?

Ans. next() method returns the next sibling element of the selected element.

18. What is the use of the prev() method?

Ans. prev() method returns the previous sibling method of the selected element.

19. What is the use of the parent() function?

Ans. parent() function returns the parent element of the selected element.

20. What is the use of the children() function?

Ans. children() function returns the children elements of the selected element.

21. What is the use of the siblings() function?

Ans. siblings() function returns all the sibling elements of the selected element.

Monday, 3 August 2015

23 - Javascript Interview questions


1. What is JavaScript?

Ans Javascript is a client-side scripting language that is understood by browsers.

2. What is the use of isNaN function?

Ans isNan() function returns true if the variable is not number otherwise it returns false.

3. Define this keyword in javascript.

Ans this keyword used to point the current object in the code.

4. Is JavaScript case sensitive?

Ans Yes

5. What is the syntax to use the external javascript file?

Ans.  <script type="text/javascript" src="test.js"></script>

6. How to write a comment in javascript?

Ans. 1. // test comment
        2. /* test comment */

7. How do you change the style/class on any element?

Ans. document.getElementById("Id").style.fontSize = "";
        -or-
        document.getElementById("Id").className = “anyclass”;

8.  What data types are supported in Javascript?

Ans. Number, String, Undefined, null, Boolean

9. How to disable control using Javascript?

Ans. document.getElementById("Id").disabled="true"

10. How to make control read-only using Javascript?

Ans. document.getElementById("Id").readOnly="true"

11. Which company developed JavaScript?

Ans. NetScape

12. How to submit a form using javascript?

Ans. using docuemnt.form[0].submit();

13. Explain the difference between "==" and "==="?

Ans. "==" check the equality only while "===" checks the equality as well as the type.

14. What would be the result of 4+3+"7"?

Ans. 77

15. What will be the output of the following ?

var x=10;
var y=x++;
var z=++x;
Ans. x=12 , y=10 , z=12.

16. What will be the output of the following?

0 == -0
Ans. true

17. What will be the output of the following?

var x;
if(typeof x === 'undefined')
Ans. true

18. How can we empty the array in javascript?

Ans. var array=['1','2','3'];
array=[];

19. How to check the object is an array or not?

Ans. using Array.isArray[array_variable]

20. What will be the output of the following condition?

Ans. if(Number("1")==1)
        {
        }
Ans. true

21. What is the use of Number.isInteger method?

Ans. Number.isInteger is used to check whether the value is number or not.
        For Example :
        if(Number.isInteger(1))
       {
       }
      This condition is true.

22. How can we read the properties of an object in Javascript?
Ans. using dot(.) notation.

23. What is the difference between "var" and "let" keywords?
Ans.  "var"  has function scope and "let" has block scope.

Friday, 31 October 2014

Get Third Highest Salary Sql Query


Get Third Highest Salary 


SELECT TOP (1) * FROM
   (SELECT TOP (3) Empsalary FROM employeeMaster ORDER BY empsalary DESC) T
ORDER BY empsalary ASC

Friday, 16 May 2014

json

  public class address
    {
        public string address1, address2,city,state,country;
        public int pin;
   
    }

    public class person

    {
        public string firstname, lastname, department;

        public address adr = new address();


        public string[] technologies;

    }



 public void serialize_json()

    {
 
        person p1 = new person();
        p1.firstname = "Sapna";
        p1.lastname = "Giyanwani";
        p1.department = "Asp.net";
        p1.adr.address1 = "Saijpur Bogha";
        p1.adr.address2 = "Naroda Road";
        p1.adr.city = "Ahmedabad";
        p1.adr.state = "Gujarat";
        p1.adr.country = "India";
        p1.adr.pin=382345;
        p1.technologies = new string[] {"C","C++" ,"ASp.net" };

        str = js.Serialize(p1);

     

    }


    public void deserialize_json()

    {
        person p2 = js.Deserialize<person>(str);

        Response.Write(p2.firstname);

    }

Sunday, 2 February 2014

How to create EXE in Visual Studio

1. Open Visual Studio.
2. Open your Project.
3. From Solution Explorer right-click Solution (project)--> Add -->New Project ...




















4. Select Other Project Types --> Setup and Deployment --> Visual Studio Installer --> Select Setup Wizard. Write a name and click OK.




















5. Click Next.






































6. Select Create a setup for windows application.

7. Click Next.
8. Select Primary Output from Project.
9. Click Next.


10. Click Add and select your app config file.


11. Click Open.
12. Click Next and then Finish.


13. Click Finish.


14. Click the Application folder at the left side.

15. Right Click Application Folder and add Project Icon that you want to set.



16. Select Icon.


18. Now Right Click Primary Output and Click Create a shortcut to Primary Output from Project.

19. Give a name to exe. and from shortcut property set Icon.


20. Now Drag and Drop Exe to User's Desktop.


21. Now-Again Create shortcut and Drag and Drop it to User's Program Menu.


22. Now From Solution Explorer -- > Select Project and From--> View -- >Select Properties Window.

23. Set Publisher name and company name. 

24. Now Right Click Setup from Solution Explorer. And click Build.

25. In Project Folder you will find EXE in the Release folder.

26. Install Exe and check.





Friday, 24 January 2014

Passing QueryString in Asp.net

1. Open Visual Studio
2. Create a New Website
3. Add web page
4. from Website - >Add New Item -> WebPage- > Click Add.
5. Add Button Control.

6. Write code in button click event as below

   protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("DashBoard.aspx?username=sapna&password=123456");
    }

7. Add New Page named DashBoard.aspx

8. Add Two label controls in DashBoard.aspx.

9. Write code inside Page_Load Event as below.


 protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["username"] != null && Request.QueryString["password"]!=null)
        {
            lblusername.Text = Request.QueryString["username"].ToString();
            lblpassword.Text = Request.QueryString["password"].ToString();
        }
    }

10. Run Code you will get querystring values in two labels.

SQL server tricky questions