SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    Non-Member
    Join Date
    Nov 2008
    Location
    internettrix.blogspot.com
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Java Script Interview Questions

    Java Script Interview Questions

    few important javascript inteview question
    if you know the answer do post them
    it would be very helpful

    1.JavaScript and JScript?
    How and in what ways does JavaScript differ from JScript?

    2.Redirecting a page
    How to redirect a page using JavaScript

    3.Implement Timer Control
    How to implement timer control in JavaScript

    4.Java swing
    why is java swing so efficiently used in most graphics programming and not effected by systems graphic properties?

    5.Differenece between @Posted commands and @commands

    6.How do you call function in javascript?

    7.How do you get field value in javascript?

    8.How do you check validations in javascript?

    9.Difference between computed field and Computed for display?

    10.How do you restrict user not to copy web page in Java Script ?

    11.Script to check every character
    Write a code to get the text box data and to check each and every char?

    12.How will you insert data into db2 using JavaScript?

    13.What is flapjax and what are its benefits compared to javascript . How it converts flapjax code to javascript

    14.How to validate a Email-address, in Form using JavaScript?

    15.What is the difference between java and java script?

    16.How to prevent a window not to be clicked or selected any way in java script?

    17.What are the methods of validating whether the form is secure?

    18.Write sample code for pagination using java script.

    19.What is javascript and what is it functionality?

    20.What is the main difference between Client side JavaScript and and Server side Java Script. How actually

    21.Explain about session? Where it runs & what are different types of session handling?

    22.How to add a combo box dynamically at run time in Java script?

    23.How to go next field without filling the text? Which function should use.Phone No Text validation in

    24.How to use email validation in Java script.Like User can't enter invalid email address?

  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,294
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Sounds more like a test than an interview.....most of those are searchable though.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    test?

    it's a homework assignment
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    Sydney, Australia
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    huh? Most of those questions are so vague!

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Java Script Interview Questions

    few important javascript inteview question
    if you know the answer do post them
    it would be very helpful

    1.JavaScript and JScript?
    How and in what ways does JavaScript differ from JScript?

    JavaScript is the ECMAScript standard, whereas JScript is the microsoft specific flavour that is restricted to version 1.3 of ECMAScript.

    2.Redirecting a page
    How to redirect a page using JavaScript

    location.href = 'page.html';

    3.Implement Timer Control
    How to implement timer control in JavaScript

    myTimer = setTimeout(fn, time);

    4.Java swing
    why is java swing so efficiently used in most graphics programming and not effected by systems graphic properties?

    Swing is to do with Java, not JavaScript. It's the difference between cat and catburgler

    5.Differenece between @Posted commands and @commands

    That's not JavaScript either.

    6.How do you call function in javascript?

    You place parenthesis on the end of the function name.

    7.How do you get field value in javascript?

    var text = field.value;

    8.How do you check validations in javascript?

    form.onsubmit = validate;

    9.Difference between computed field and Computed for display?

    That's not JavaScript either.

    10.How do you restrict user not to copy web page in Java Script ?

    You cannot because the web page is publicly accessible. Some people try to disable the right-click button, but there are always easy workarounds.

    11.Script to check every character
    Write a code to get the text box data and to check each and every char?

    Code javascript:
    var text = form[field].value;
    return validates = !!(/^[a...z]+$/.exec(text));

    12.How will you insert data into db2 using JavaScript?

    By using AJAX

    13.What is flapjax and what are its benefits compared to javascript . How it converts flapjax code to javascript

    flapjax is a templating library built on top of JavaScript..
    The flapjax compiler converts it into JavaScript

    14.How to validate a Email-address, in Form using JavaScript?

    With the following regular expression from http://www.regular-expressions.info/email.html

    Code javascript:
    /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/

    There are simpler less effective email validations that can be performed too. For example:

    Code javascript:
    /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/

    15.What is the difference between java and java script?

    That's like asking what's the difference between C++ and C# - they're both completely different languages designed for different purposes.

    16.How to prevent a window not to be clicked or selected any way in java script?

    Don't load the window. Seriously.

    17.What are the methods of validating whether the form is secure?

    All client-side forms are insecure, because you can't guarantee that javascript will be running when the form is submitted. Best results are by validating the form on the server-side, then use JavaScript to improve the user experience.

    18.Write sample code for pagination using java script.

    Use jQuery

    Code javascript:
    function pageselectCallback(page_id, jq) {
        $('#Searchresult').text("Showing search results " + ((page_id * 10) + 1) + "-" + ((page_id * 10) + 10));
    }
    $(document).ready(function() {
        // Create pagination element
        $("#Pagination").pagination(300, {
            num_edge_entries: 2,
            num_display_entries: 8,
            callback: pageselectCallback
        });
    }

    19.What is javascript and what is it functionality?

    JavaScript is a client-side scripting language.

    20.What is the main difference between Client side JavaScript and and Server side Java Script. How actually

    Client-side runs on the client but you cannot guarantee that javascript is enabled on the client. Server-side will always run providing the client supports that feature.

    21.Explain about session? Where it runs & what are different types of session handling?

    Sessions run on the server and use cookies to store state information.

    22.How to add a combo box dynamically at run time in Java script?

    By using the DOM.

    23.How to go next field without filling the text? Which function should use.Phone No Text validation in

    Use the mouse to click on the next field. The function to use for phone no text validation is

    24.How to use email validation in Java script.Like User can't enter invalid email address?

    Validate the form on the server-side, then perform client-side validation to improve the user experience.
    Last edited by paul_wilkins; Nov 17, 2008 at 06:15.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @viron86, you don't deserve the answers that Paul has given you. Have you heard of Google? Maybe a library? Typing 90% of those questions straight in to Google would get you what you're looking for. Whether this is a homework assignment or a test I'm sure your teacher/professor would be horrified by what you did! How about some proper research! Lazy! (I don't mean offense by this, I am only reflecting what I feel!) If it were me I would do some proper research instead of taking advantage of the all-too-willing Sitepoint forum contributors!

    Edit:


    All the above is IMHO.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    For reference, the questions were all from http://www.geekinterview.com/Intervi...eb/java-Script where people post typical interview questions in order to share typical answers.

    The next time I may provide the answers in a random order, and leave it up to the reader to match up the answer with the correct question.
    It may be interesting to obtain the correct answers though when half of them are "That's not JavaScript either"
    Last edited by paul_wilkins; Nov 17, 2008 at 06:21.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Zealot joazito's Avatar
    Join Date
    Mar 2005
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A former colleague of mine got asked that question about validating a form. He went on to say that javascript validation is much better than server side because it's faster...

    He got the job.

  9. #9
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    That all depends on how you define "better". I would agree that javascript validation is better than server-side validation when it comes to speed.

    However, server-side validation should be maintained to prevent those naughty script-kiddies from submitting unvalidated data, and them russian mafia people too.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  10. #10
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by joazito View Post
    He got the job.
    and they got the candidate they deserved
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  11. #11
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Is it that time of year again already?

    Regular as clockwork are these posts.
    Ian Anderson
    www.siteguru.co.uk

  12. #12
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by joazito View Post
    He got the job.
    He shouldn't have.

    Saying that client-side validation is "better" than server-side solely because of its speed is just stupid and frankly shows your friends ignorance more than anything else.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  13. #13
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pmw57 View Post
    However, server-side validation should be maintained to prevent those naughty script-kiddies from submitting unvalidated data, and them russian mafia people too.
    Damn the Mafia! They're always looking to submit unvalidated data, what a cheeky little operation they've got going there!
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  14. #14
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    The questions come around time and time again but occasionally the techniques change. For example:

    Code javascript:
    /*
    document.write(answersHTML); // long time ago
    document.getElementById('answers').innerHTML = answersHTML; // medium time ago
    document.getElementById('answers').appendChild(answersDOM); // short time ago
    */
    addContent('answers', answersDOM); // recently
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  15. #15
    SitePoint Addict
    Join Date
    Oct 2008
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does that email validation really works, have anyone tested it?

  16. #16
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Yes, it returns true for my email address :-)

    In truth, no email validation is complete. The large one above allows all of the proper characters that can be allowed in email addresses, but it doesn't check top-level domains properly. It can help to have several regular expressions that the email address filters through, each designed to perform separate tasks depending on how careful you want to be.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •