FUNDAMENTALS OF COMPUTER

COMPUTER PROGRAMMING FUNDAMENTALS

WHAT IS PROGRAMMING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If str1=‘Yes’ and str2=‘No’, what is the result for str1+str2 in Python?
A
‘YesNo’
B
‘Yes No’
C
Yes-No
D
Yes and No
Explanation: 

Detailed explanation-1: -return (str1-str2); computes the difference of pointers str1 and str2 and returns this value as an int . The difference of 2 pointers is defined if they point to the same array and evaluates to the number of elements between them.

Detailed explanation-2: -To check if a String str1 contains another string str2 in Java, use String. contains() method. Call contains() method on the string str1 and pass the other string str2 as argument. If str1 contains the string str2, then contains() method returns true.

Detailed explanation-3: -The return value from strcmp is 0 if the two strings are equal, less than 0 if str1 compares less than str2, and greater than 0 if str1 compares greater than str2 . No other assumptions should be made about the value returned by strcmp .

Detailed explanation-4: -You can compare strings in Python using the equality ( == ) and comparison ( <, >, !=, <=, >= ) operators. There are no special methods to compare two strings.

There is 1 question to complete.