Write a function named is_palindrome that accepts a string p…

Write a function named is_palindrome that accepts a string parameter and returns true if that string is a palindrome, or false if it is not a palindrome. For this problem, a palindrome is defined as a string that contains exactly the same sequence of characters forwards as backwards, case-insensitively. Spaces, punctuation, and any other characters should be treated the same as letters; so a multi-word string or string with numbers or punctuation would count as a palindrome too. Below are some sample calls Function Call Value Returned is_palindrome(“madam”) true is_palindrome(“RacCAr”) true is_palindrome(“dog god”) true is_palindrome(“123 $$ 321”) true is_palindrome(“madham”) false is_palindrome(“antena”) false is_palindrome(“Taco cat”) false is_palindrome(TACOcat) true

Demonstrate your understanding of bitwise operations by eval…

Demonstrate your understanding of bitwise operations by evaluating the following expressions and writing their results in binary. unsigned char this = 0xa5; unsigned char that = 0x97; Expression Binary Result this [b1] that [b2] this & that [b3] this | that [b4] this ^ that [b5] ~this [b6] this > 1 [b8] (that >> 2) & 17 [b9] this & ~that [b10] ~that & (this

Fill in the textboxes with the text that should go in the sp…

Fill in the textboxes with the text that should go in the spot on the same line with a _____ in the below code so that each variable is declared as the type it stores and each call to print_variable passes in an int*. Fill in the printf in print_variable so that the number stored in the parameter is printed. If a variable declaration will not work or a call is made using a variable that will not work write the word broken in the box. If no * or & are needed in a call write ok in the box.  void print_variable(int* var) { printf(“%d\n”, ______); [a1] } int main() { int a = 4; ______ b = a; [a2] ______ c = *a; [a3] ______ d = &a; [a4] ______ e = &&b; [a5] ______ f = &d; [a6] ______ g = *f; [a7] print_variable( ____a ); [a8] print_variable( ____b ); [a9] print_variable( ____c ); [a10] print_variable( ____d ); [a11] print_variable( ____e ); [a12] print_variable( ____f ); [a13] print_variable( ____g ); [a14] }

Consider the following function: void mystery(int list[], in…

Consider the following function: void mystery(int list[], int length) { for (int i = 1; i < length; i++) { if (list[ i - 1 ] % 2 == 0) { list[ i - 1 ]++; list[ i ]++; } } } In the left-hand column below are specific arrays of integers. Indicate in the right-hand column what values would be stored in the array after the call to function mystery in the left-hand column. Write your answer surrounded by curly braces with number separated by commas. Original Contents of Array Final Contents of Array int a1[] = {12, 7}; mystery(a1, 2); [a1] int a2[] = {2, 3, 4, 5, 6}; mystery(a2, 5); [a2] int a3[] = {3, 4, 5, 7, 9}; mystery(a3, 5); [a3] int a4[] = {2, 3, 5, 7, 9}; mystery(a4, 5); [a4] int a5[] = {4, 5, 9, 6, 2}; mystery(a5, 5); [a5]

Write a function called num_unique that takes a sorted array…

Write a function called num_unique that takes a sorted array of integers and an integer repesenting the length of that array as parameters and that returns the number of unique values in the array. The array is guaranteed to be in sorted order, which means that duplicates will be grouped together. For example, if a variable called list stores the following values: {5, 7, 7, 7, 8, 22, 22, 23, 31, 35, 35, 40, 40, 40, 41} then the following call num_unique(list, 15) should return 9 because this list has 9 unique values (5, 7, 8, 22, 23, 31, 35, 40 and 41). It is possible that the array might not have any duplicates. For example if list instead stored this sequence of values: {1, 2, 11, 17, 19, 20, 23, 24, 25, 26, 31, 34, 37, 40, 41} then a call on the function would return 15 because this list contains 15 different values. If passed an empty array, your function should return 0. Remember that you can assume that the values in the array appear in sorted (nondecreasing) order. You are not allowed to use a temporary array, string or struct to solve this problem and you are not allowed to call library functions to help you solve it.

For each call to the following function, indicate what value…

For each call to the following function, indicate what values are printed and returned: int mystery(int n, int m) { if (n == 0 || m == 0) { printf(“-“); return 0; } else if (n % 10 == m % 10) { printf(“1”); return 1 + mystery(n / 10, m / 10); } else { printf(“0”); return mystery(n / 10, m / 10); } } Call Output Returned value mystery(18, 0); [a1] [aa1] mystery(8, 18); [a2] [aa2] mystery(25, 21); [a3] [aa3] mystery(305, 315); [a4] [aa4] mystery(20734, 1724); [a5] [aa5]

Write a function called switch_data that takes as a paramete…

Write a function called switch_data that takes as a parameter a pointer to a file containing a label followed by a sequence of integers and that prints to the console the same information with each successive pair of integers switched in order. For example, suppose that a FILE* called data contains the following tokens: Jan 1 2 3 4 5 6 Here the label is Jan. The label will always be a single word less than 15 characters long that appears at the beginning. After the label, we have a series of six integers. If we make the following call: switch_data(data); the function should produce the following output: Jan 2 1 4 3 6 5 Notice that the first pair of integers (1, 2) has been switched (2, 1), and the second pair of integers (3, 4) has been switched (4, 3), and so on. This first example involved sequential integers to make the switching more obvious, but this won’t always be the case. You also shouldn’t assume that you have an even number of integers. If there is an odd number of integers, then the final value should not be moved. For example, if the FILE* had instead contained these tokens: Feb 38 14 79 4 -3 then the function would have produced the following output: Feb 14 38 4 79 -3 There will always be a one-word label, but the list of integers might be empty, in which case the function simply prints the label on a line by itself. Your function should produce a complete line of output. In other words, if it is called n times, it will produce n lines of output. You may assume that the input is legal (a one-word label followed by 0 or more integer values). You may not construct any arrays to help you solve this problem. 

Define a new type called Rectangle that can be used for stor…

Define a new type called Rectangle that can be used for storing all the information necessary to be able to draw a rectangle at a particular x, y location of a particular width and height (all whole numbers). The x, y refer to the position of the upper left corner of the rectangle. Assume that x is 0 at the top and grows as it goes down. Assume that y is 0 on the left and grows as as it goes right. The user should be able to construct a Rectangle located at an x of 10, a y of 17, 100 wide and 50 tall by writing: Rectangle rect = {10, 17, 100, 50}. Write a function called contains that takes two pointers to Rectangles as parameters and returns true if the second rectangle is entirely contained inside the first and false otherwise. You can assume both passed in Rectangles will be valid. That means they will have x, y coordinates of 0 or greater and widths and heights of 0 or greater. Rectangle big = {10, 25, 100, 100}; Rectangle small = {30, 25, 50, 10}; bool fits = contains(&big, &small); After the above call fits would store true because the small’s left side starts after big’s (30 vs 10), small’s right side ends before big’s (80 vs 110), small’s top starts the same place as big’s (25 vs 25) and small’s bottom edge ends before big’s (35 vs 125) Rectangle bigish {10, 25, 50, 50}; Rectangle smallish {30, 25, 50, 10}; bool fits2 = contains(&bigish, &smallish); After the above call fits2 would store false because the left side of bigish occurs before the left side of smallish but the right side of bigish also occurs before the right side of smallish.