Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Write a program that takes a String

through Command Line argument and display the length of

the string. Also display the string into uppercase and check whether it is a palindrome or not.



Write a class to represent dates (i.e., day/month/year). Add methods that should perform operations such as determining the number of days between two dates, add two dates, determining the number of months between two dates and determining the day of the week that a particular date falls on. Write a test class to confirm that your date class works.


a program which get the value of three numbers x, y and z from user and check whether x and y are equal and greater than z



10.Subtract every elements in 2D array a2d with 1d array b1d, such that the first row’s elements of a2d subtracts the first element of b1d, the second row’s elements of a2d subtract the second element of b1d and the third row’s elements of a2d subtract the third element of b1d.


a2d = np.array([[10,10,10],[11,11,11],[12,12,12]])

b1d = np.array([2,3,4])


Answer:


Output:

array([[8, 8, 8],

       [8, 8, 8],

       [8, 8, 8]])


7.Write a code to get the positions where elements of array a and array b are same

a = np.array(['a','b','c','b','c','d','c','d','e','f'])

b = np.array(['g','b','j','b','g','d','i','d','i','h'])


Answer:


Output:

(array([1, 3, 5, 7], dtype=int64),)


8.List the items which are present in array a but NOT present in array b

a = np.array(['a','b','c','d','e'])

b = np.array(['c','d','e','f','g'])


Answer:


array(['a', 'b'], dtype='<U1')


9.Reverse the sequence of rows in 2-D array

a = np.arange(16).reshape(4,4)


Answer:


Output:

array([[12, 13, 14, 15],

    [ 8, 9, 10, 11],

    [ 4, 5, 6, 7],

    [ 0, 1, 2, 3]])


4.Convert a 1-D array into a 2-D array

a = np.array(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'])


Answer:


Output:

array([['a', 'b', 'c'],

    ['d', 'e', 'f'],

    ['g', 'h', 'i'],

    ['j', 'k', 'l']], dtype='<U1')


5.Add 101 to all the values in given array

a = np.arange(16).reshape(4,-1)


Answer:


Output:

array([[101, 102, 103, 104],

    [105, 106, 107, 108],

    [109, 110, 111, 112],

    [113, 114, 115, 116]])


6.Extract the last 5 columns of this 2-D array

a = np.arange(100).reshape(5,-1)


Answer:


Output:

array([[15, 16, 17, 18, 19],

    [35, 36, 37, 38, 39],

    [55, 56, 57, 58, 59],

    [75, 76, 77, 78, 79],

    [95, 96, 97, 98, 99]])


1.Convert the 1-D array to 3-D array

a = np.array([x for x in range(32)])


Answer:


print(o)


Output:

array([[[ 0, 1, 2, 3, 4, 5, 6, 7],

    [ 8, 9, 10, 11, 12, 13, 14, 15]],


    [[16, 17, 18, 19, 20, 21, 22, 23],

    [24, 25, 26, 27, 28, 29, 30, 31]]])


2.Convert the value in the array to appropriate data type

a = np.array([[7.2, 5.4, 9.3],

       [3.8, 6.7, 8.5]])


Answer:


print(o)


Output:

[[7 5 9]

 [3 6 8]]


3.Extract value in between 7 to 15 from the given array

a = np.array([2, 6, 1, 9, 10, 3, 27])


Answer:


print(o)


Output:

[ 8 12 9 11]


In the IPv4 Header format following information is given in decimal number system, with


respect to the given information calculate the header checksum value. (10)


VER=4


HLEN =6


Service type=9


Total length=26


Identification=2


Flag=3


Fragmentation offset=0


Time to live=5


Protocol=12


Source IP Address=11.13.12.6


Destination IP Address=10.6.8.11

Find the first address, last address and the number of addresses of a network whose one


of the IP addresses is 50.28.22.75 / 25.


(5 marks question).

Mention and explain each field of IPv4 header in detail, by taking suitable examples.


(5 marks)

LATEST TUTORIALS
APPROVED BY CLIENTS