## Compound Literals in C

Updated on 30-Jul-2019 22:30:25
In this section we will see what is the compound literals in C. The compound literals are introduced in C99 standard in C. Using this feature, it can create unnamed objects. In the following example we will see how to use compound literal to generate object without any name.Example#include struct point {    int x;    int y; }; void display_point(struct point pt) {    printf("(%d,%d)", pt.x, pt.y); } main() {    display_point((struct point) {10, 20}); }Output(10,20)

## Transpose a matrix in Python?

Updated on 30-Jul-2019 22:30:25
Transpose a matrix means we’re turning its columns into its rows. Let’s understand it by an example what if looks like after the transpose.Let’s say you have original matrix something like -x = [[1, 2][3, 4][5, 6]]In above matrix “x” we have two columns, containing 1, 3, 5 and 2, 4, 6.So when we transpose above matrix “x”, the columns becomes the rows. So the transposed version of the matrix above would look something like -x1 = [[1, 3, 5][2, 4, 6]]So the we have another matrix ‘x1’, which is organized differently with different values in different places.Below are couple ... Read More

## How much willing you are to improve traffic conditions in India?

Updated on 30-Jul-2019 22:30:25
Driving a car in India is really a challenge. The constant increase in vehicles, small lanes, and uncontrollable traffic conditions is creating a lot of stress when people get on the road with a two wheeler or four wheeler.As a citizen, I want the traffic conditions in India to be improved. I have a few suggestions to the authorities and request them to implement the same.Check speed violations and issue challans immediately.Road encroachments should be arrested and roads should be widened to fit the increasing traffic.Strict laws for auto rickshaws, share autos and maxi-vans should be implemented to avoid illegal ... Read More

## Instruction cycle in 8085 Microprocessor

Updated on 30-Jul-2019 22:30:25
The Program and data which are stored in the memory, are used externally to the microprocessor for executing the complete instruction cycle. Thus to execute a complete instruction of the program, the following steps should be performed by the 8085 microprocessor.Fetching the opcode from the memory;Decoding the opcode to identify the specific set of instructions;Fetching the remaining Bytes left for the instruction, if the instruction length is of 2 Bytes or 3 Bytes;Executing the complete instruction procedure.The given steps altogether constitute the complete instruction cycle. These above mentioned steps are described in detail later. The above instructions are assumed by ... Read More

## C++ Program to Perform Stooge Sort

Updated on 30-Jul-2019 22:30:25
Stooge Sort is used to sort the given data. It is a recursive sorting algorithm. Stooge Sort divides the array into two overlapping parts, 2/3 each and Sort the array in three steps by sorting I then II and again I part. The worst case time complexity of this algorithm is O(n^2.7095).AlgorithmBegin Take input of data. Call StoogeSort() function with ‘a’ the array of data and ‘n’ the number of values, in the argument list. Implement Sorting using recursive approach. Divide the array into first 2/3 element as ... Read More

## Iterate through Quartet class in JavaTuples

Updated on 30-Jul-2019 22:30:25
You can also iterate through Quartet class like Arrays using a loop.Let us first see what we need to work with JavaTuples. To work with Quartet class in JavaTuples, you need to import the following package −import org.javatuples.Quartet;Note − Steps to download and run JavaTuples program. If you are using Eclipse IDE to run Quartet Class in JavaTuples, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file.The following is an example −Exampleimport org.javatuples.Quartet; public class Demo { public static void main(String[] args) { ... Read More

## What do the id and scope attribute mean in the action elements in JSP?

Updated on 30-Jul-2019 22:30:25
These are two attributes that are common to all Action elements: the id attribute and the scope attribute.Id attributeThe id attribute uniquely identifies the Action element and allows the action to be referenced inside the JSP page. If the Action creates an instance of an object, the id value can be used to reference it through the implicit object PageContext.Scope attributeThis attribute identifies the lifecycle of the Action element. The id attribute and the scope attribute are directly related, as the scope attribute determines the lifespan of the object associated with the id. The scope attribute has four possible values:(a) ... Read More

## How to format percentages in JSP?

Updated on 30-Jul-2019 22:30:25
The tag is used to format numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to displayYesNonetypeNUMBER, CURRENCY, or PERCENTNoNumberpatternSpecify a custom formatting pattern for the output.NoNonecurrencyCodeCurrency code (for type = "currency")NoFrom the default localecurrencySymbolCurrency symbol (for type = "currency")NoFrom the default localegroupingUsedWhether to group numbers (TRUE or FALSE)NotruemaxIntegerDigitsMaximum number of integer digits to printNoNoneminIntegerDigitsMinimum number of integer digits to printNoNonemaxFractionDigitsMaximum number of fractional digits to printNoNoneminFractionDigitsMinimum number of fractional digits to printNoNonevarName of the variable to store the formatted numberNoPrint to pagescopeScope of the variable to store the formatted numberNopageExample ... Read More

## LocalDate lengthOfYear() method in Java

Updated on 30-Jul-2019 22:30:25
The length of the year in a particular LocalDate is obtained using the method lengthOfYear() in the LocalDate class in Java. This method requires no parameters and it returns the length of the year in a particular LocalDate i.e. 365 or 366 for a leap year.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalDate ld = LocalDate.parse("2019-02-15"); System.out.println("The LocalDate is: " + ld); System.out.println("The length ... Read More

## LongStream toArray() method in Java

Updated on 30-Jul-2019 22:30:25
The toArray() method of the LongStream class returns an array containing the elements of this stream.The syntax is as follows.long[] toArray()To use the LongStream class in Java, import the following package.import java.util.stream.LongStream;Create LongStream and add some elements.LongStream longStream = LongStream.of(25000L, 28999L, 6767788L);Create a Long array and use the toArray() method to return the elements of the stream as array elements.long[] myArr = longStream.toArray();The following is an example to implement LongStream toArray() method in Java.Example Live Demoimport java.util.*; import java.util.stream.LongStream; public class Demo {    public static void main(String[] args) {       LongStream longStream = LongStream.of(25000L, 28999L, 6767788L);     ... Read More