Answer:
d. public myClass( ) {. . .}
Explanation:
A constructor is a special method that is called when an object of a class is created. It is also used to initialize the instance variables of the given class. A class may have one or more constructors provided that these constructors have different signatures. A class that does not have a constructor explicitly defined has a default parameterless constructor.
Having said these about a constructor, a few other things are worth to be noted by a constructor.
i. In Java, a constructor has the same name as the name of its class.
For example, in the given class <em>myClass</em>, the constructor(s) should also have the name <em>myClass</em>.
ii. A constructor does not have a return value. It is therefore wrong to write a constructor like this:
<em>public void myClass(){...}</em>
This makes option a incorrect.
iii. When a constructor with parameters is defined, the default parameterless constructor is overridden. This might break the code if some other parts of the program depend on this constructor. So it is advisable to always explicitly write the default parameterless constructor.
This makes option d a correct option.
Other options b and c may also be correct but there is no additional information in the question to help establish or justify that.
Answer:
#include<stdio.h>
//declare a named constant
#define MAX 50
int main()
{
//declare the array
int a[MAX],i;
//for loop to access the elements from user
for(i=0;i<MAX;i++)
{
printf("\n Enter a number to a[%d]",i+1);
scanf("%d",&a[i]);
}
//display the input elements
printf("\n The array elements are :");
for(i=0;i<=MAX;i++)
printf(" %d ",a[i]);
}
Explanation:
PSEUDOCODE INPUTARRAY(A[MAX])
REPEAT FOR I EQUALS TO 1 TO MAX
PRINT “Enter a number to A[I]”
READ A[I]
[END OF LOOP]
REPEAT FOR I EQUALS TO 1 TO MAX
PRINT A[I]
[END OF LOOP]
RETURN
ALGORITHM
ALGORITHM PRINTARRAY(A[MAX])
REPEAT FOR I<=1 TO MAX
PRINT “Enter a number”
INPUT A[I]
[END OF LOOP]
REPEAT FOR I<=1 TO MAX
PRINT A[I]
[END OF LOOP]
Answer:
16 subnets and 14 hosts assignable IP addresses.
Explanation:
Computer networking is the interconnection and intercommunication of computer devices. These computer devices can be connected using cables or wirelessly. All devices in a network must have an IP address.
Subnetting a network is a process of preventing the waste of IP addresses for the purpose of security and cost. IP4 addresses are 32 bits in size (4 octets) and the host and subnet size is dependant on the host and network bit configuration.
The IP address 200.245.10.150/28 is a class A network address but subnetted to borrow four bits from the fourth octet to produce 16 subnets (2 ^ 4 bits borrowed) and 14 host IP addresses (2^ 4 bits remaining in the fourth octet - 2, which is the network and broadcast addresses).