Answer:
Benefit: Artificial Intelligence is taking us to ground breaking levels in medicine and science
Negative: As Artificial inTelligence slowly becomes smarter it can take over jobs, which could lead to increased unemployment
Explanation:
Answer:
return value =2.
Here the function f() returns the length of the substring we traversed before we find the same character at the equal index of two substrings.
Take the inputs s= “abcd” and t= “bccd”.
• Now, p1 points to s1, i.e., p1 points to the character ‘a’ of “abcd”. And similarly, p2 points to ‘b’ of “bccd”.
• Then we compare the values at p1 and p2, are not equal, so p1 and p2 both are incremented by 1.
• Now the characters ‘b’ and ‘c’ of “abcd” and “bccd” respectively are compared. They are not equal. So both p1 and p2 both are incremented by 1.
• Now, p1 points to ‘c’ of “ abcd” that is the element at index 2 of s. And p2 points to ‘c’ of “bccd” that is the element at index 2 of t. Here value at p1 and p2 becomes equal. So the break statement is executed. We stop moving forward.
• As p1 is pointing to index 2 and s is pointing to the base that is index 0, so p1-s = 2.
Explanation:
#include<stdio.h>
int f(char *s, char *t);
void main()
{
int k = f("abcd", "bccd");
printf("%d", k);
}
int f(char *s, char *t)
{
char *p1, *p2;
for(p1 = s, p2 = t; *p1 != '\0'&& *p2 != '\0'; p1++, p2++)
{
if (*p1 ==*p2)
break;
}
return (p1-s);
}
OUPUT is given as image
Answer:
False
Explanation:
To iterate at least once the condition controlling the while loop must be true, and this is independent of the fact of being an infinite while loop or a normal while loop. If the condition is false the program will skip the while loop and will continue with the rest of the program. The way to create an infinite while loop is using a condition that always is going to be true, for example, while ( 3 ) or while (true). The value three is non zero meaning is always true, and true also is always true.