EzDevInfo.com

parameters interview questions

Top parameters frequently asked interview questions

What are the Xms and Xmx parameters when starting JVMs?

Please explain the use of Xms and Xmx parameters in JVMs. What are the default values for them?


Source: (StackOverflow)

Pass a JavaScript function as parameter

How do I pass a function as a parameter without the function executing in the "parent" function or using eval()? (Since I've read that it's insecure.)

I have this:

addContact(entityId, refreshContactList());

It works, but the problem is that refreshContactList fires when the function is called, rather than when it's used in the function.

I could get around it using eval(), but it's not the best practice, according to what I've read. How can I pass a function as a parameter in JavaScript?


Source: (StackOverflow)

Advertisements

How can I pass a parameter to a setTimeout() callback?

I have some JavaScript code that looks like:

function statechangedPostQuestion()
{
  //alert("statechangedPostQuestion");
  if (xmlhttp.readyState==4)
  {
    var topicId = xmlhttp.responseText;
    setTimeout("postinsql(topicId)",4000);
  }
}

function postinsql(topicId)
{
  //alert(topicId);
}

I get a error that topicId is not defined Everything was working before i used the setTimeout() function.

I want my postinsql(topicId) function to be called after some time. What should i do?


Source: (StackOverflow)

How are parameters sent in an HTTP POST request?

In an HTTP GET request, parameters are sent as a query string:

http://example.com/page?parameter=value&also=another

In an HTTP POST request, the parameters are not sent along with the URI.

My question is, where are the values? In the request header? In the request body? What does it look like?


Source: (StackOverflow)

How to run an EXE file in PowerShell with parameters with spaces and quotes

How do you run the following command in PowerShell?

C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql="Data Source=mysource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;" -dest:dbfullsql="Data Source=.\mydestsource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;",computername=10.10.10.10,username=administrator,password=adminpass"


Source: (StackOverflow)

What's the difference between an argument and a parameter?

When verbally talking about methods, I'm never sure whether to use the word argument or parameter or something else. Either way the other people know what I mean, but what's correct, and what's the history of the terms?

I'm a C# programmer, but I also wonder whether people use different terms in different languages.

For the record I'm self-taught without a background in Computer Science. (Please don't tell me to read Code Complete because I'm asking this for the benefit of other people who don't already have a copy of Steve McConnell's marvellous book.)

Summary

The general consensus seems to be that it's OK to use these terms interchangeably in a team environment. Except perhaps when you're defining the precise terminology; then you can also use "formal argument/parameter" and "actual argument/parameter" to disambiguate.


Source: (StackOverflow)

What does int argc, char *argv[] mean?

In many C++ IDE's and compilers, when it generates the main function for you, it looks like this:

int main(int argc, char *argv[])

When I code C++ without an IDE, just with a command line compiler, I type:

int main()

without any parameters. What does this mean, and is it vital to my program?


Source: (StackOverflow)

How can I read command line parameters from an R script?

I've got a R script for which I'd like to be able to supply several command-line parameters (rather than hardcode parameter values in the code itself). The script runs on Windows.

I can't find info on how to read parameters supplied on the command-line into my R script. I'd be surprised if it can't be done, so maybe I'm just not using the best keywords in my Google search...

Any pointers or recommendations?


Source: (StackOverflow)

Get url parameter jquery Or How to Get Query String Values In js

I have seen lots of jQuery examples where parameter size and name are unknown. My url is only going to ever have 1 string:

http://example.com?sent=yes

I just want to detect:

  1. Does sent exist?
  2. Is it equal to "yes"?

Source: (StackOverflow)

Arguments or parameters? [duplicate]

This question already has an answer here:

I often find myself confused with how the terms 'arguments' and 'parameters' are used. They seem to be used interchangeably in the programming world.

What's the correct convention for their use?


Source: (StackOverflow)

How many parameters are too many? [closed]

Routines can have parameters, that's no news. You can define as many parameters as you may need, but too many of them will make your routine difficult to understand and maintain.

Of course, you could use a structured variable as a workaround: putting all those variables in a single struct and passing it to the routine. In fact, using structures to simplify parameter lists is one of the techniques described by Steve McConnell in Code Complete. But as he says:

Careful programmers avoid bundling data any more than is logically necessary.

So if your routine has too many parameters or you use a struct to disguise a big parameter list, you're probably doing something wrong. That is, you're not keeping coupling loose.

My question is, when can I consider a parameter list too big? I think that more than 5 parameters, are too many. What do you think?


Source: (StackOverflow)

Perform Segue programmatically and pass parameters to the destination view

in my app I've a button that performs a segue programmatically:

- (void)myButtonMethod
{
    //execute segue programmatically
    [self performSegueWithIdentifier: @"MySegue" sender: self];
}

I would like to know if there is a way to reference the destination view and to pass it some parameters.

I know that in prepareForSegue method, I can refer to it with:myDestinationViewController *vc = [segue destinationViewController];, but I don't know how to this executing the segue programmatically.

Do you have any ideas?

Thanks, yassa


UPDATE:

I'm sorry for this question!!! I simply discovered that, even if the segue is invoked programmatically, the prepareForSegue method is called anyway and so it is possible to pass parameters in the same usual way.


Source: (StackOverflow)

Passing a dictionary to a function in python as keyword parameters

I'd like to call a function in python using a dictionary.

Here is some code:

d = dict(param='test')

def f(param):
    print param

f(d)

This prints {'param': 'test'} but I'd like it to just print test.

I'd like it to work similarly for more parameters:

d = dict(p1=1, p2=2)
def f2(p1,p2):
    print p1, p2
f2(d)

Is this possible?


Source: (StackOverflow)

In C#, what happens when you call an extension method on a null object?

Does the method get called with a null value or does it give a null reference exception?

MyObject myObject = null;
myObject.MyExtensionMethod(); // <-- is this a null reference exception?

If this is the case I will never need to check my 'this' parameter for null?


Source: (StackOverflow)

What is "String args[]"? parameter in main method Java

I'm just beginning to write programs in Java. What does the following Java code mean?

public static void main(String[] args)
  • What is String[] args?

  • When would you use these args?

Source code and/or examples are preferred over abstract explanations


Source: (StackOverflow)