Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Interview Questions-2
#1
Not Solved
Hi Friends, I want to post Interview Questions every day. So that the people who are under trails can get familiarize with the QTP and it's related questions. So here are the questions for today......
'********************************************************
1) How you will write a recursive function to get the Fibonacci series?
2) How you will display all the upper case alphabet characters in reverse order except the characters mentioned in the string.
Eg: if my string is "Sri" then the result should have all the alphabets from "Z to A" except the following letters "S","R" and "I".
3) What is the difference between byte comparison and text comparison in instr function?
4) What is ANSI character code, how "a" is different from "A"?
5) How you will get the number of ".xls" files present in all the sub-folders present in the specified path?
'********************************************************
Thanks,
SUpputuri
Reply
#2
Not Solved
For 2nd Question the reply is

Code:
'Taking All the Alphabets at iniative and reversing the string
s = StrReverse("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
MsgBox s
' At runtime provide the data so that these letters will not appear in output andthis string will be taken in Capital letters
x = UCase(InputBox("Enter a string : "))
MsgBox x
'taking each value from String s and initializing the count variable
For i=1 to len(s)
    a =mid(s,i,1)
    cnt =0
'taking string as one character at a time at runtime which should be checked
    For j=1 to len(x)
        b = Mid(x,j,1)
' Comparing the values of a and b,if they are not equal i am incrementing the count.        
        If a<>b Then
                        cnt =cnt+1
        End If
                        Next
'Identifying the string length which i have given at runtime,then iam going to print the character
            If cnt=len(x)Then
                      print a
        End If
        Next

Now Enjoy
Reply
#3
Not Solved
For the 1st question,

1) How you will write a recursive function to get the Fibonacci series?

Code:
Dim i,j,k
Dim Fib

i = 1
j = 0
k = 0
Fib = 20

Fibonacci(Fib)

Function Fibonacci(Fib)
    For z=0 to Fib
    Print k
    j = i
    i = k
    k = i+j
    Next
End Function
Reply
#4
Not Solved
1) How you will write a recursive function to get the Fibonacci series?
ANS:
Code:
Fibonacci(inputbox("Enter Number"))

Function Fibonacci(Fib)
If  Fib>=2 Then
     a=0
     b=1
     print a  
     print b
        For i=1 to Fib-2
            k=a+b
            print k
            a=b
            b=k
        Next
Else
msgbox "Please Enter The Number Greaterthan  1"
end if
End Function
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Interview Questions praveen.sharma 4 5,907 08-23-2022, 02:07 PM
Last Post: ahmad3029
  Interview Questions supputuri 12 13,504 08-23-2022, 11:45 AM
Last Post: ahmad3029
  Interview question nandha 0 1,874 03-28-2018, 03:32 PM
Last Post: nandha
  Few Interview Question asked in various Companies.. shailesh.2.singh@bt.com 1 3,460 08-08-2017, 09:24 AM
Last Post: mallika199317@gmail.com
  Interview Question raghavaqtp 1 3,774 12-20-2014, 09:55 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)