Question

Question 1 Which pre-written C function can be used to determine if two strings are the...

Question 1
Which pre-written C function can be used to determine if two strings are the same?

A) equals

B) strcmp

C) strlen

D) strcpy

E) None of the Above

Question 2
The function below is most like which existing string function?

int f(char a[ ]) {
               int count = 0;
               while (a[count] != ‘\0’)
                              count++;
               return count;
}

A) strcat

B) strcmp

C) strcpy

D) strlen

E) None of the Above

Question 3
The function below is most like which existing string function?

void f(char a[ ], char b[ ]) {
               int i, length = strlen(a);
               for (i=0; i                               a[i+length] = b[i];
}

A) strcat

B) strcmp

C) strcpy

D) strlen

E) None of the Above

Question 4
What is the output of the following segment of code?

char a[20] = "foot";
char b[20] = "ball";
strcat(b,a);
printf("%s", b);

A) foot

B) ball  

C) football         

D) ballfoot

E) None of the Above

Question 5
What is the purpose of the function below?   (Note: n is the length of a.)

int f(int a[ ], int n) {
               int i, val=a[0];
               for (i=1; i                               if(val < a[i])
                                             val = a[i];
               return val;
}

A) To return the maximum value in a

B) To return the minimum value in a.

C) To return the sum of all the values in the array a.

D) To return the number of even numbers in the array.

E) None of the Above

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per requirement submitted above kindly find below solution.

Question 1:

Answer:B) strcmp

Explanation : strcmp function in c is inbuilt function which is used to determine two strings are equal or not.

********************************

Question 2:

Answer:D) strlen

Explanation :strlen is inbuilt function which is equivalent to above code snippet.

********************************

Question 3:

Answer:A) strcat

Explanation :Given code snippet is used to concatenate two arrays.

********************************

Question 4:

Answer:D) ballfoot

Explanation :Below screen shows the output.

********************************

Question 5:

Answer:A) To return the maximum value in a

Explanation :Below screen shows the output

********************************

NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
Question 1 Which pre-written C function can be used to determine if two strings are the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I'm getting errors that i can't figure out. I need help fixing them. particularly focus on...

    I'm getting errors that i can't figure out. I need help fixing them. particularly focus on the errors they are highlighted in bold on the list code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <ctype.h> #include "stack.h" #include "booleanEvaluation.h" #include "booleanWithError.h" /* evaluatePostfix * input: a postfix expression * output: T, F, or E * * Uses a stack to evaluates the postfix expression and returns the result as a string where "T" denotes true and "F" denotes...

  • which function in the string library can be used to combine two strings? strcmp strlen strcat...

    which function in the string library can be used to combine two strings? strcmp strlen strcat combine none

  • In C Programming Language In this lab you will implement 4 string functions, two using array...

    In C Programming Language In this lab you will implement 4 string functions, two using array notation and two using pointers. The functions must have the signatures given below. You may not use any C library string functions. The functions are 1. int my strlen (char s ) - This function returns the number of characters in a string. You should use array notation for this function. 2. int my strcpy (char s [], char t I)- This function overwrites...

  • In Programming language C - How would I convert my words char array into a string...

    In Programming language C - How would I convert my words char array into a string array so I can use the strcmp() function and alphabetically sort the words? #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main(int argc, char*argv[]){ int i =0; int j =0; int count =0; int length = strlen(argv[1]); for(i =0; i < length; i++){ if(isalpha(argv[1][i]) == 0 ||isdigit(argv[1][i] != 0)){ count ++; } printf("%c",argv[1][i]); } char *strings; int wordNum =0; int charNum =0; strings...

  • Can you help me make these two methods listed below work? I have code written but...

    Can you help me make these two methods listed below work? I have code written but it is not working. I would appreciate any advice or help. Function "isAPalidrome" accepts an array of characters and returns an integer. You must use pointer operations only, no arrays. This function should return 1 (true) if the parameter 'string' is a palindrome, or 0 (false) if 'string' is not a palindrome. A palindrome is a sequence of characters which when reversed, is the...

  • I need help with the creation of the pre and post conditions for each function of...

    I need help with the creation of the pre and post conditions for each function of my program. Please see below. #include <iostream> #include <string.h> using namespace std; #define TOTAL_COMMANDS 7 struct command { char name[1024]; // Store the name of the command int *paramsCount; // Stores the valid no. of params char error[4096]; // Stores the valid errors int differentParams; // Store no. of different ways to specify params int differentErrors; // Store no. of different ways to error...

  • Help please this is C/C++ code /* * Lab12, the purpose of this lab is to...

    Help please this is C/C++ code /* * Lab12, the purpose of this lab is to improve your skills in handling c strings * with pointers . * use of : strlen ,string concatenation strcat, compare strcmp, * copy strcpy and search strrchr * */ #include <cstdlib> #include <iostream> #include<cstring> using namespace std; /** * Create a method that prompts the user for only lowercase letters to represent * a name. * Start a Label, then prompt the user to...

  • Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C -...

    Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...

  • Which part of this program is used for input one context free grammar? And if you...

    Which part of this program is used for input one context free grammar? And if you want to give another different context free grammar, how to do that? code: #include<stdio.h> #include<stdlib.h> #include<string.h> #define MaxVtNum 20 #define MaxVnNum 20 #define MaxPLength 20 #define MaxSTLength 50 char stack[20]={'#','E'}; char input[MaxSTLength]; char termin[MaxVtNum]={'i','+','*','(',')','#'}; char non_termin[MaxVnNum]={'E','G','T','H','F'}; struct product{ char left; char right[MaxPLength]; int length; }; struct product E,T,G,G1,H,H1,F,F1; struct product M[MaxVnNum][MaxVtNum]; int flag=1; int top=1; int l; void print_stack(){ } } } } }...

  • If you already answer this question, please skip, thanks C Programming. Fill in ... This program...

    If you already answer this question, please skip, thanks C Programming. Fill in ... This program will be called with one command line argument that contains a string followed by an asterisk and an integer. Print out the string as many time as indicated by the integer. For example, when called as prog Hi*3, you print HiHiHi. Hint: Look for the '*' starting from the back of the string. len = strlen(arg) gives you the string length. When you have...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT