Write a recursive function that adds all the elements in an array. The function will take two arguments, 1) An integer value that is greater than 0 and indicates the size of the array, and 2) An integer array of that size. The function should return an integer value that is the sum of the elements in the array. The function should add elements of the input array using recursion and should not use a loop.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a recursive function that adds all the elements in an array. The function will take two arguments, 1) An integer value that is greater than 0 and indicates the size of the array, and

2) An integer array of that size. The function should return an integer value that is the sum of the elements in the array.

The function should add elements of the input array using recursion and should not use a loop.


ii) 

Read both a string and the key (integer) is entered through the keyboard. Define a function to encrypt each and every character in a string with the given key. As a programmer, implement the same by writing the C code using pointers. If the given Key is positive, then traverse towards left of the character in the Alphabet sequence. Otherwise, move traverse towards the right of the character in the Alphabet sequence.

Example : if the given string is "PRADEEP" and Key = 3 then the encrypted string is "SUDGHHS" 


iii)

An ISBN (International Standard Book Number) is a 10 digit number that is used to identify a book. The first nine digits of the ISBN number are used to represent the Title, Publisher and Group of the book and the last digit is used for checking whether ISBN is correct or not. To uniquely identify a book a 10-digit ISBN number is used. The rightmost digit is checksum digit. This digit is determined from the other 9 digits using condition that 10d1 + 9d2 + 8d3 + ... + d10 must be a multiple of 11 (where di denotes the ith digit from the right). The checksum digit d1 can be any value from 0 to 10: the ISBN convention is to use the value X to denote 10. Write a C program using pointers that receives a 10-digit ISBN, and computes the checksum, and reports whether the ISBN number is correct or not.

Example: 007462542X = 10*0 + 9*0 + 8*7 + 7*4 + 6*6 +  5*2 + 4*5 + 3*4 + 2*2 + 1*10 = 176
Since 176 leaves no remainder when divided by 11, hence it is a valid ISBN.

0112112425 = 10*0 + 9*1 + 8*1 + 7*2 + 6*1 + 5*1 + 4*1 + 3*4 + 2*2 + 1*5 = 71Since 71 is not divisible by 11, given number is not a valid ISBN.

Note: When the check digit turns out to be "10" an "X" is written in the ISBN check digit place ["X" is the Roman numeral for 10] so that there are exactly 10 symbols used in an ISBN.

 


iv)

A 5X5 Crossword grid is provided to you, along with a set of words (or names of places) that need to be filled into the grid. Cells are marked either + or -. Cells marked with a - are to be filled with the word list. Write a C program for the above scenario.

 

The following shows an example crossword from the input  crossword grid and the list of words to fit,

words={ Delhi, Haji, If}

Input:+-+++

+-+++

+-+++

+- - - -

+-+++-

Output:

+D+++

+E+++

+L+++

+HAJI

+I++F

DELHI;HAJI;IF

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY