Assume memory is divided into blocks that are a power of 2 in size, starting at address 0. The blocks may be words, doublewords, pages, and so on. Then, given a starting address "A" and a length "L", we wish to determine whether or not the address range from "A" to "A+L-1" crosses a block boundary. The quantities "A" and "L" are unsigned and any values that fit in a register are possible. Pictorially, |---N------|----N-----|----N------| +----------+----------+---- ... ---+----------+ | | | | | +----------+----------+---- ... ---+----------+ ^ |----L---| | | A Write small piece of C code, to know if A+L crosses a boundary. Challenge again is not to use division or modulo operator :-)
Write an efficient function in C that deletes characters from a string. Use the prototype: void RemoveChars(char str[], char remove[]); where any character existing in remove must be deleted from str. For example, given a str of "Battle of the Vowels:Hawaii" and remove of "aeiou", the function should transform str to "Bttl f th Vwls:Hw vs. Brzny". Justify any design decisions you make and discuss the efficiency of your solution.
Write an algorithm to check whether a given unsigned number is a multiple of 3, without using division and modulo operators.
Prove that n*(n+1)*(2*n+1) is divisible by 6, for any n>0
Given an 8x8 chessboard, * How many "total" number of squares are present in the board? * How many "total" number of rectangles are preent in the board? (for this problem assume that rectangles must have length and breadth different)