| Back to Questions Page |
| Question |
what all the metrics to be checked for a document ? |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Sobha |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
Quesetion is not clear.
metrics varies based on type of document.
Byee friends
Rajendra
rajendra_penumalli@yahoo.com  |
0 | Rajendra |
| |
| |
| Question |
write testcase for print option using mswod |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Sobha |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
in ms-word first check out the printer is connected
properly.
then check when we give print command its doesn't show any
error.
if error shows then print is not working.
first click on the print option and then ok
go to file option of ms-word and then click on print.
u also give print command by pressing the button ctrl+p
then check out the pages to be printed  |
0 | Nitin |
| |
| |
| Question |
can any body give the code to write the function for given
suppose user login with usrer id and pwd to yahoomail.after
cliking "sign in"if it is valid user id the next page will
display userid'message box.( Note u have to use excel sheet
to retrive the userid's data) |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Jayanta |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
'Create an excel sheet with username and password
'Get username and password from the excel sheet
Set excelobj=createobject("excel.application")
excelobj.workbooks.open("C:\Documents and
Settings\12Desktop\test data.xls")
usrname=excelobj.sheets(1).cells(2,1)
pwd=excelobj.sheets(1).cells(2,2)
excelobj.workbooks.close
' add the objects to the Object Repository
'Function for username
Function username
If Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The
best").WebEdit("login").Exist Then
If Browser("Yahoo! Mail: The best").Page("Yahoo!
Mail: The best").WebEdit("login").GetROProperty("disabled")
=false Then
Browser("Yahoo! Mail: The best").Page
("Yahoo! Mail: The best").WebEdit("login").Set usrname
reporter.ReportEvent
micpass,"WebEdit","UsernameEntered: "&usrname
End If
else
reporter.ReportEvent
micfail,"WebEdit","Username Not Entered"
End If
End Function
'Calling the username function
username
'Function for password
Function password
If Browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The
best").WebEdit("passwd").Exist Then
If Browser("Yahoo! Mail: The best").Page("Yahoo!
Mail: The best").WebEdit("passwd").GetROProperty("disabled")
=false then
Browser("Yahoo! Mail: The best").Page
("Yahoo! Mail: The best").WebEdit("passwd").Set pwd
reporter.ReportEvent
micpass,"WebEdit","Password Entered: "&pwd
End If
else
reporter.ReportEvent
micfail,"WebEdit","Password Not Entered"
End If
End Function
'calling the password function
password
'checking the username is valid or not
username="bhadrudu_p"
getdata=Browser("Yahoo! Mail: The best").Page("(1 unread)
Yahoo! Mail").WebElement("bhadrudu_p").GetROProperty
("innertext")
Function usrvalid
If trim(getdata)=trim(username) Then
reporter.ReportEvent micpass,"WebElement","Valid
user"
else
reporter.ReportEvent micfail,"WebElement","Welcome
page not present"
End If
End Function
usrvalid  |
0 | Badri |
| |
| |
|
|
| |
| Answer |
Hello Mr.Badri,
Script is good,
if anybody don't know scripting they will feel difficult to understand your script, please reduce complexity while answering, here no need to use always reporter events you can display with msgbox or with print statements.
How do you think this is correct validation,
--> you get the user name from excel sheet and placed in user name field.
--> you get the text available in user name field again
--> validating these two values.
no test case will be fail if you do testing like this.
you forgot one more thing you have to click Sign In button with out doing this how could you conclude that the user is valid or not....!
Once you get Home page or mail box page then you can conclude that user name is valid
or
If you don't get any error msg or popup after clicking on Login In then also you can ensure that the user is valid.
If anybody want me to give code, I will give.
above code also correct but some what complexity...!  |
0 | Bfakruddin |
| |
| |
| Answer |
'-----------------------------------------------------------
--------Create the Connection String -----------------------
------------------------------------------------------------
---------
Function fgGetConnection( )
'****
'Purpose: Get
connection to Excel Workbook
'****
Dim objConnection
Set objConnection = CreateObject
("ADODB.Connection")
objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0
;Data Source='D:\Test Data\Test_Data.xls' ;Extended
Properties=Excel 8.0;"
Set fgGetConnection = objConnection
End Function
'-----------------------------------------------------------
--------Close the excel connection -------------------------
------------------------------------------------------------
-------
Function fgCloseConnection ( objConnection )
'****
'Purpose: Close connection to
Excel Workbook
'****
objConnection.Close
End Function
'-----------------------------------------------------------
--------Fetch the test data from the excel -----------------
------------------------------------------------------------
---------------
Function fgGetData (objConnection, strColumnName, Sheet,
intPageNumber, TestSetName)
'****
'Purpose: Queries the Excel Workbook
for one field in the particular Sheet
' - Can also take a string
with comma separated values to get all the columns and give
it back as an array.
'****
'MsgBox strColumnName
'MsgBox Sheet
'MsgBox intPageNumber
'MsgBox TestSetName
Dim objRecordSet,
strQuery
Dim strScenarioID
Set objRecordSet =
CreateObject("ADODB.recordset")
objRecordSet.CursorType = 3 'set CursorType to be
able to do a RecordCount
strQuery
= "SELECT " & strColumnName & " FROM ["&Sheet& "$] WHERE
Test_Set = '" & TestSetName & "' AND Step_Number =" &
intPageNumber & " AND TestStatus='Y'"
objRecordSet.open
strQuery, objConnection
Select Case
objRecordSet.RecordCount
Case 0
fgGetData = ""
Case Else
If InStr(objRecordSet(0),
Chr(10)) > 0 Then
fgGetData = Replace
( objRecordSet(0), Chr(10), vbNewLine )
Else
fgGetData =
objRecordSet(0)
' msgbox fgGetData
End If
End Select
objRecordSet.Close
End Function
'***********************************************DB
Connection Start
Function****************************************************
****************************
Public Function CreateruntimeObject(Sheetname,ObName)
' msgbox ObName
set
conn=createobject("ADODB.CONNECTION")
set
recset=createobject("ADODB.RECORDSET")
conn.provider="MICROSOFT.JET.OLEDB.4.0"
conn.open "data source='D:\Object
Repository\Object.xls'; Extended properties=EXCEL 8.0"
qry="Select
Properties from [" & Sheetname& "$] where ObjName='"
&ObName& "'"
recset.open qry,
conn, 1, 1
props= recset.Fields(0)
'Create object description
for the data fetched from the excel sheet.
Set obj=description.create()
arrprops=split(props, "|")
For i=0 to UBOUND
(arrprops)
arrprop=split(arrprops(i), "=")
propname=arrprop(0)
propvalue=arrprop(1)
obj
(propname).value=propvalue
Next
Set CreateruntimeObject=obj
'if object not present????
End Function
'-----------------------------------------------------------
-------- Functional Result update in the testData Excel-----
------------------------------------------------------------
----------------------------
Public Function Resultupdate(objConnection,
Sheet,TestSetName, intPageNumber, Result, Status)
objConnection.Execute "update ["&Sheet&"$]
set TestResult ='" & Result & "', TestStatus ='" & Status
& "', Execution_Date =Now where Test_Set = '" &
TestSetName & "' and Step_Number =" & intPageNumber & ""
End Function
'-----------------------------------------------------------
--------GUI Result update in the testData Excel-----------
------------------------------------------------------------
----------------------
Public Function ResultupdateGUI(objConnection,
Sheet,TestSetName, Result, Status,objVal,objroPty)
objConnection.Execute "update
["&Sheet&"$] set TestResult ='" & Result & "', TestStatus
='" & Status & "', Execution_Date =Now where Test_Set
= '" & TestSetName & "' AND TestStatus='Y' AND
Objval='"&objVal&"' AND Objroproperty='"&objroPty &"' "
End Function
'-----------------------------------------------------------
--------Function for Close Application --------------------
------------------------------------------------------------
-------------
Function CloseApplication(Application)
dim strcompname,
strprocesstokill, objwmiservice, compname
dim colprocess
Set WshNetwork =CreateObject
("WScript.Network")
compname=WshNetwork.computername 'Get the computer
name
Set objwmiservice=Getobject
("Winmgmts:\\" &compname & "\root\cimv2") 'Get the task
manager
set
colprocess=objwmiservice.execquery("Select * from
win32_process where name='"&Application&"'")
' Get all the
processes in an arrary and terminate the required process
from the task manager.
For each process in
colprocess
msg=process.name
reporter.ReportEvent micDone, msg, msg & " this has been
terminated"
process.terminate()
Next
End Function
'-----------------------------------------------------------
--------Invoke outlook Folder Function ---------------------
------------------------------------------------------------
-----------
Function InvokeOutlookFedex()
Const olFolderInbox = 6
Set objOutlook =
CreateObject("Outlook.Application")
'
'If Dialog
("regexpwndclass:=#32770", "regexpwndtitle:=Personal
Folders Password").Exist(1) Then
' pass=Input("Enter
your Password")
' Dialog
("regexpwndclass:=#32770", "regexpwndtitle:=Personal
Folders Password").WinEdit("attached text:=Type the
password for.*").Set pass
'End If
Set objNamespace =
objOutlook.GetNamespace("MAPI")
Set objInbox =
objNamespace.GetDefaultFolder(olFolderInbox)
'msgbox objInbox
strFolderName =
objInbox.Parent
'msgbox strFolderName
Set objMailbox =
objNamespace.Folders(strFolderName)
Set objFolder =
objMailbox.Folders("FedEx QuickShip")
'msgbox objFolder
wait(5)
objFolder.display
wait(3)
Window(MainPage).maximize
End Function
Public Function Alternateobject(Sheetname,ObName)
' msgbox ObName
set conn=createobject("ADODB.CONNECTION")
set recset=createobject("ADODB.RECORDSET")
conn.provider="MICROSOFT.JET.OLEDB.4.0"
'conn.open "Provider=MS.Remote;" & "Remote
Server=\\Wm6103rbw-1331;" & "Remote Provider =
MICROSOFT.JET.OLEDB.4.0;" & "data source='\\Wm6103rbw-1331
\Object Repository\Object.xls'; Extended properties=EXCEL
8.0"
conn.open "data source='D:\Object
Repository\Object.xls'; Extended properties=EXCEL 8.0"
qry="Select Alternate_Prop from [" & Sheetname& "$]
where ObjName='" &ObName& "'"
recset.open qry, conn, 1, 1
props= recset.Fields(0)
''Gets the value into an array
' Do Until recset.eof
' For each val in recset.fields
' props=val.value
' msgbox props
' Next
' recset.movenext
' Loop
'Create object description for the data fetched from the
excel sheet.
Set obj=description.create()
arrprops=split(props, "|")
For i=0 to UBOUND(arrprops)
' msgbox arrprops(i)
arrprop=split(arrprops(i), "=")
propname=arrprop(0)
propvalue=arrprop(1)
' msgbox propname
' msgbox propvalue
obj(propname).value=propvalue
Next
Set Alternateobject=obj
'if object not present????
End Function  |
0 | Hari |
| |
| |
| Question |
Q: Testing across diffrent languages is called?
(suryah2@yahoo.com.au) |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: R.surya |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
Its called Internationalisation testing i,e I18N. I18N is
the term used for testing among different international
languages .
Localisation testing is the term used for testing among
various regional languages .  |
0 | Phani_k07 |
| |
| |
| Answer |
MULTI-LANGUITY/FOREIGN LANGUAGES TESTING.
The testing applicable on multi languity s/w's ,which are
developed in JAVA UNICODE TECHNOLOGY.
This can be done in two ways-
Localization- Tester can go to convert english to different
languages.
Globalization/Internationalization-Tool can go to convert
english to diffenrent languages.  |
0 | Kavisrikanth8 [Eventzero] |
| |
| |
| Question |
what are the difference between qtp8.2 to 9.0
surya |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: R.surya |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
Over and above features provided with QTP 8.0 , QTP 9.2
provides following features:
Mercury Screen Recorder :
Capture your entire run session in a movie clip or capture
only the segments with errors, and then view your movie
from the Test Results window.
Dynamic Management of Object Repositories:
QuickTest now has a new RepositoriesCollection reserved
object that you can use to programmatically manage the set
of object repositories that are associated with an action
during a run session.
Over and above features provided with QTP 8.2 , QTP 9.0
provides following features:
Object Repository Manager:
You can use the Object Repository Manager to manage all of
the shared object repositories in your organization from
one, central location. This includes adding and defining
objects, modifying objects and their descriptions,
parameterizing test object property values, maintaining and
organizing repositories, and importing and exporting
repositories in XML format.
You can open multiple object repositories at the same time.
Each object repository opens in its own resizable document
window. This enables you to compare the content of the
repositories, to copy or move objects from one object
repository to another, and so forth.
Object Repository Merge Tool:
You can use the Object Repository Merge Tool to merge the
objects from two shared object repositories into a single
shared object repository. You can also use the Object
Repository Merge Tool to merge objects from the local
object repository of one or more actions or components into
a shared object repository.
When you merge objects from two source object repositories,
the content is copied to a new, target object repository,
ensuring that the information in the source repositories
remains unchanged.
If any conflicts occur during the merge, for example, if
two objects have the same name and test object class, but
different test object descriptions, the relevant objects
are highlighted in the source repositories, and the
Resolution Options pane details the conflict and possible
resolutions.
Multiple Object Repositories per Action or Component:
QuickTest provides several options for storing and
accessing test objects. You can store the test objects for
each action or component in its corresponding local object
repository, which is unique for each action and component.
You can also store test objects in one or more shared
object repositories that can be used in multiple actions
and components. Alternatively, you can use a combination of
objects from the local object repository and one or more
shared object repositories. You choose the combination that
matches your testing needs.
XML Object Repository Format:
QuickTest now enables you to import and export object
repositories from and to XML format. This enables you to
modify object repositories using the XML editor of your
choice and then import them back into QuickTest. You can
import and export files either from and to the file system
or a Quality Center project (if QuickTest is connected to
Quality Center).
Function Library Editor:
QuickTest now has a built-in function library editor, which
enables you to create and edit function libraries
containing VBScript functions, subroutines, modules, and so
forth, and then call their functions from your test or
component.
Handling Missing Actions and Resources:
Whenever a testing document (test, component, or
application area) contains a resource that cannot be found,
QuickTest opens the Missing Resources pane and lists the
missing resource(s). For example, a test may contain an
action or a call to an action that cannot be found; a
testing document may use a shared object repository that
cannot be found; or a testing document may use a object
repository parameter that does not have a default value. In
all of these cases, QuickTest indicates this in the Missing
Resources pane, enabling you to map a missing resource to
an existing one, or remove it from the testing document, as
required  |
0 | Ajreddy |
| |
| |
| Question |
Hi,
this is sekhar yadav,
when the testing starts... |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Svsekhar2003 |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
Based on the you are company followes project life cycel.  |
0 | Vasubabu |
| |
| |
| Answer |
different companies follows different types of software
development models,depending up on the size.In small and
medium companies follows a clasic waterfall model lik
model,in which testing is starts after development process
is complets,some medium and big organizations follows V
model lik model in which testing starts right from Business
requirment documnet or SRS,and it will continue untill
product relese.  |
0 | Krrish |
| |
| |
| Answer |
as soon as possible when the requirement is getting  |
0 | Keshab |
| |
| |
| Answer |
Based on the system requirement specificaiton(SRS) we will
write the test cases and then starts testing.  |
0 | S.j.kumaresh |
| |
| |
| Answer |
It depend on the life cycle model of your company.
generally aafter preperation of the test cases they will be
get approved from the client.
before starting the execution shake out will be done to
check weather the build was done properly or not on the
application
this is call as FFA.  |
0 | Naresh |
| |
| |
| Answer |
Testing Starts "As early as Possible" in the development
life cycle.
Static testing or Review used to test the SRS, FS, TEST PLAN
etc....
Prabhu Subramanian
CSS India Pvt Ltd.  |
0 | Prabhu |
| |
| |
| Answer |
Actually testing starts from the requirement phase onwards.
Once the requirements are baselined(srs) then we will go
for writing testcases.Execution of our tests will be
started during the testing phase after the release of the
build.  |
0 | Asn |
| |
| |
| Answer |
Testing should be start end of software development and
After prepare the test plan of the project  |
0 | Ravichandran |
| |
| |
| Question |
Is ResultSet class? |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
no ResultSet is interface  |
0 | P.sreekiran |
| |
| |
| Question |
Can we override static methods? |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
no we cannot overriding the static methods .
if we override the static method it will gives error  |
0 | P.sreekiran |
| |
| |
| Answer |
Yes, V can override static methods
But overridding and overridden methods must static  |
0 | Venkateswara Reddy |
| |
| |
| Answer |
yes ,we can override the static methods to a nonstatic or
static methods  |
0 | Karun |
| |
| |
| Answer |
YES, WE CAN OVERRIDE STATIC METHODS BY STATIC METHODS  |
0 | Guest |
| |
| |
| Answer |
yes ,we can override the static methods to static methods
only.
sorry for the previous my wrong answer.:((((  |
0 | Karun |
| |
| |
| Answer |
Yes, Static Methods can be overridden but it won't give
overridden behaviour. Overiding execution happens based on
the runtime object.  |
0 | N.suresh Babu |
| |
| |
| Answer |
It may seems to be overriding the static methods, but the
real fact is HIDING.
class Foo {
public static void classMethod() {
System.out.println("classMethod() in Foo");
}
public void instanceMethod() {
System.out.println("instanceMethod() in Foo");
}
}
class Bar extends Foo {
public static void classMethod() {
System.out.println("classMethod() in Bar");
}
public void instanceMethod() {
System.out.println("instanceMethod() in Bar");
}
}
class StaticHiding {
public static void main(String[] args) {
Foo f = new Bar();
f.instanceMethod();
f.classMethod();
when u run this program output will be:
instanceMethod() in Bar
classMethod() in Foo.
Here if u say it to be overriding then the
subclass ie., Bar class having static classMethod() should
be executed. But the fact here is Foo class static
classMethod() is executed.
So its method HIDING and not method
overriding..
I hope i have given answer to my best if
anyone feels wrong plz do post ur suggestions..  |
1 | Sadheez |
| |
| |
| Answer |
yes we can override static method but can not overload that
is called method hiding nt overloading.  |
0 | Neha Jain |
| |
| |
| Answer |
Neha,
I didn't get your answer.
You can overload as well as override static methods, but
only with static methods.
I have tried it and it is getting compiled.
Example is here.
*********************************************************
public class abc
{
public static void main(String args[])
{
}
public static void trss()
{
}
public static void trss(int i)
{
}
}
*********************************************************  |
0 | Yogesh Gandhi |
| |
| |
| Answer |
we cannot override a static method but we can overload a
static method.
Ex: override is not possible
class Foo {
public static void classMethod() {
System.out.println("classMethod() in Foo");
}
public void instanceMethod() {
System.out.println("instanceMethod() in Foo");
}
}
class Bar extends Foo {
public static void classMethod() {
System.out.println("classMethod() in Bar");
}
public void instanceMethod() {
System.out.println("instanceMethod() in Bar");
}
}
class StaticHiding {
public static void main(String[] args) {
Foo f = new Bar();
f.instanceMethod();
f.classMethod();
when u run this program output will be:
instanceMethod() in Bar
classMethod() in Foo.
Ex: overload is possible
public class abc
{
public static void main(String args[])
{
}
public static void trss()
{
}
public static void trss(int i)
{
}
}  |
0 | Madan Mohanp |
| |
| |
| Answer |
Thanks for addition.
You are correct.
Static method cannot be overridden.
Overloading of static methods is possible.  |
0 | Yogesh Gandhi |
| |
| |
| Answer |
dear yogesh
sory for wrong answer we can not override static method
with static method that known as method hiding.plz view
following example
Briefly, when you override a method, you still get the
benefits of run-time polymorphism, and when you hide, you
don't. So what does that mean? Take a look at this code:
class Foo {
public static void classMethod() {
System.out.println("classMethod() in Foo");
}
public void instanceMethod() {
System.out.println("instanceMethod() in Foo");
}
}
class Bar extends Foo {
public static void classMethod() {
System.out.println("classMethod() in Bar");
}
public void instanceMethod() {
System.out.println("instanceMethod() in Bar");
}
}
class Test {
public static void main(String[] args) {
Foo f = new Bar();
f.instanceMethod();
f.classMethod();
}
}
If you run this, the output is
instanceMethod() in Bar
classMethod() in Foo  |
0 | Neha Jain |
| |
| |
| Answer |
We can't override the static method we can only redefine
them  |
0 | Devender Negi |
| |
| |
| Answer |
Yes, We can! see Below---
public class Final1 {
public static void mone() {
System.out.println("Iam in final method of
super class");
}
}
public class Final extends Final1{
public static void mone() {
System.out.println("Iam in final method of
sub class");
}
public static void main(String a[]) {
Final f = new Final();
f.mone();
}
}  |
0 | Rambabu |
| |
| |
| Question |
How will you create the class for the following scenario?
Employees under one employee?
|
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Guest |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
Employee class
SubEmployee extends Employee  |
0 | Satya |
| |
| |
| Answer |
class Employee {
Integer empCode;
String firstName;
String lastName;
List<Employee> subEmployees;
}  |
0 | Jagdish |
| |
| |
| Question |
what is reference parameter?
what is out parameters?
what is difference these two? |
Rank |
Answer Posted By |
|
Interview Question Submitted By :: Somavenki |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer |
a ref parameter must first be initialized before being
passed from the calling function to the called function.
but a out parameter need not be initialized, we can pass it
directly  |
1 | Anna |
| |
| |
| Answer |
normally while we are passing values to other methods it
will pass copy of the values.But we use ref or out
parameter it pass reference of values.  |
1 | Aravazhi [Hasten Technologies] |
| |
| |
| Answer |
When we pass a parameter as ref to a method, the method
refers to the same variable and changes made will affect
the actual variable. even the variable passed as out
parameter is same as ref parameter, but implementation in
c# is different,
Arguement passed as ref parameter must be initialized
before it is passed to the method. But in case of out
parameter it is not necessary. But after a call to a method
as out parameter it is necessary to initialize.
When to use out and ref parameter, out parameter is used
when we want to return more than one value from a method.  |
2 | Lakshmi [Hasten Technologies] |
| |
| |
| Answer |
Ref parameter can be used as both input and o/p parameter
out parameter can be used as only output parameter  |
0 | Rvs Varma [Hasten Technologies] |
| |
| |
| Answer |
The main difference between them is ref parameter act as
input/output whereas out parameter is simply act as output.
Let us understand with an example:
Out parameters "out" parameters are output only parameters
meaning they can only passback a value from a function.We
create a "out" parameter by preceding the parameter data
type with the out modifier. When ever a "out" parameter is
passed only an unassigned reference is passed to the
function.
using System;
class Test
{
static void out_test(out int x)
{
x=100;
}
static void Main()
{
int Myvalue=5;
MyMethod(Myvalue);
Console.WriteLine(out Myvalue);
}
}
Output of the above program would be 100 since the value of
the "out" parameter is passed back to the calling part.
Note
The modifier "out" should precede the parameter being
passed even in the calling part. "out" parameters cannot be
used within the function before assigning a value to it. A
value should be assigned to the "out" parameter before the
method returns.
Ref parameters "ref" parameters are input/output parameters
meaning they can be used for passing a value to a function
as well as to get back a value from a function.We create
a "ref" parameter by preceding the parameter data type with
the ref modifier. When ever a "ref" parameter is passed a
reference is passed to the function.
using System;
class Test
{
static void Mymethod(ref int x)
{
x=x+ 100;
}
static void Main()
{
int Myvalue=5;
MyMethod(Myvalue);
Console.WriteLine(ref Myvalue);
}
}
Output of the above program would be 105 since the "ref"
parameter acts as both input and output.
Note
The modifier "ref" should precede the parameter being
passed even in the calling part. "ref" parameters should be
assigned a value before using it to call a method.  |
3 | Piyush Sharma [Hasten Technologies] |
| |
| |
| Answer |
out -doesnot keep initial value or assigned value.
ref-does
void f1(out int t){
t+=100 //give error becs t has no value --true for ref
t=100 //possible
}  |
0 | Vijaysaxena [Hasten Technologies] |
| |
| |
|
| |
|
Back to Questions Page |