Learn and Grow

On December 22, 2021 by Flare Study   No comments

 Deloitte important coding questions asked in Assessment Test on 18 Dec 2021

Program 1:
The YETI (Yet searching for Extra Terrestrial Intelligence) is receiving a signal from a remote solar system. The message M is a string that contains alphabets integers and some special characters. The signal has to be segregated into two sequences, one with characters and another with sum of all integers present in the message. Write a program to segregate M into two sequences and print it.

Constraints: 

(1) The input does not contain any space 
(II) All the continuous digits make a single integer. 
(III) M contains at least one alphabet or special character. 

Input Format: 

The input contains the message, M 

Output Format: 

The first line of output contains a string that has everything except integers present in M 
The second line of output contains the sum of all integers present in M 

Sample Input 1:

1234Hi!Hello678Everyone@GoodByeto#all1

Sample Output 1:

Hi!HeloEveryoneGoodByeto#all
1913

Sample Explanation:

M=1234Hi!Hello678Everyone@GoodByeto#all1
Sum of Integers=1234+678+1=1913
Except String= Hi!HeloEveryoneGoodByeto#all

C:

#include<stdio.h>
#include <math.h>
#include<string.h>
int main()
{
char str[100];
int i, j,count,sum=0,exp,rev=0,l;
scanf("%[^\n]s",str);//Input string with numbers
l=strlen(str);//Find the Length of String
exp = 0;
for(i = l-1; i >= 0; i--) //Calculate the Sum of all the numbers present in the String
{
      if (isdigit(str[i])) {
           rev = str[i]-48;  // there are better ways to parse characters to int 
           rev = (int) pow(10, exp) * rev;
           sum += rev;  // only add when you see a digit 
      } else { exp = -1; } // reset back to 10^0 = 1 on next loop 

    exp++;
}
for(i = 0; str[i] != '\0'; ++i)//For Removing the Numbers from string
{
   while (!( (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z') || str[i] == '\0') )
      {
           for(j = i; str[j] != '\0'; ++j){
                str[j] = str[j+1];
            }
        str[j] = ‘\0’;
      }
}
puts(str);//print number free string
printf("%d",sum);//print sum on console screen
return 0;
}

Program 2:
Given a numerical array with n values from 0 to 9, find the smallest possible sum S (represented as a string) of two numbers created using the digits of the array elements. The two numbers together should include all the digits of the array

Constraints: 

Array size n should be greater than one 
Array elements should be greater than or equal to zero

Input Format:

I) The first line of input contains the array size n. 
II) The second line of input contains n elements separated by a single white space

Sample Input 1:

6
685423

Sample Output 1:

604

Sample Explanation:

Two numbers of sizes (n/2) and (n-n/2) should be created using digits of the array such that their addition should form the smallest possible number So the few numbers formed are 358 and 246 to generate the smallest sum of 604 in the output

C:

#include<stdio.h>
// C program to sort the array in an
// ascending order using selection sort

#include <stdio.h>
void swap(int* xp, int* yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}

// Function to perform Selection Sort
void selectionSort(int arr[], int n)
{
int i, j, min_idx;

// One by one move boundary of unsorted subarray
for (i = 0; i < n - 1; i++) {

// Find the minimum element in unsorted array
min_idx = i;
for (j = i + 1; j < n; j++)
if (arr[j] < arr[min_idx])
min_idx = j;

// Swap the found minimum element
// with the first element
swap(&arr[min_idx], &arr[i]);
}
}

// Function to print an array
void printArray(int arr[], int size)
{
int i;
for (i = 0; i < size; i++)
printf("%d ", arr[i]);
printf("\n");
}

// Driver code
int main()
{
int arr[] = { 6, 8, 5, 4, 2, 3};
int sum=0,num1=0,num2=0,i;
int n = sizeof(arr) / sizeof(arr[0]);
selectionSort(arr, n);//Sort Array
    for(i=0;i<n;i++){//Actual Logic for this problem
      if(i%2!=0){
        num1=num1*10+arr[i];
      }else{
        num2=num2*10+arr[i];
     }
    }
     sum=num1+num2;
     printf("%d",sum);
return 0;
}



Hello in this Article "we will Provide you a best Energy Resource Management Most Important Questions you can directly write in your Exams and our assignments"

Welcome to our blog for Studying new Things and We will Provide best notes for Different Different Field Subjects Like CSE/ECE/MBA/MCA and Many more.

Now our First Important Question of Energy Resource Management(ERM)

Q1 Write a short note on Conventional and non-conventional sources of energy.

Answer:

  •        Energy is one of the most im‖portant components of economic infrastructure.
  •         It is the basic input required to sustain economic growth. There is direct relation between the level of economic development and per capita energy consumption.
  •       Simply speaking more developed a country, higher is the per capita consumption of energy and vice-versa.

Two Main Sources of Energy:

The sources of energy are of following types:

   Classification of ERM

🡻
 


🡻Based on Traditional Use                   Based on Long Term availability

    
🡻
 


      Conventional                                       -  Renewable

      Non Conventional                            -   Non-Renewable

     Fig: Classification of ERM

 #Based on Traditional Use:

A. Conventional Resources/Source of Energy: -          

          These sources of energy are also called non renewable sources. These sources of energy are in limited quantity except hydro-electric power.

These are further classified as commercial energy and non-commercial energy:

🡻                                 Conventional Resources

 

Commercial Energy Sources                          Non-Commercial Energy Resources

       Coal                                             -Fire Wood

       Petroliam                                   -Straw

       Electricity                                                     -Dried Dung

                                 Fig. Conventional Resources

 

#Commercial Energy Sources:

These are coal, petroleum and electricity. These are called commercial energy because they have a price and consumer has to pay the price to purchase them.

(a) Coal and Lignite:

  •         Coal is the major source of energy. Coal deposits in India are 148790 million tones.
  •         Total lignite reserves found at Neyveli are 3300 million tones.
  •         In 1950-51, annual production of coal was 32 million tones.
  •         In 2005-06, annual production of coal was 343 million tones.

(b) Oil and Natural Gas:

  •         In these days oil is considered as the most important source of energy in India and the world.


  •         It is widely used in automobiles, trains, planes and ships etc.
  •         In India it is found in upper Assam, Mumbai High and in Gujarat. The resources of oil are small in India.

Natural gas has been the most important source of energy since last two decades. It can be produced in two ways:

(i) With petroleum products as associated gas.

(ii) Free gas obtained from gas fields in Assam, Gujarat and Andhra Pradesh.

(c) Electricity:

  •         Electricity is the common and popular source of energy.
  •         It is used in commercial and domestic purposes.
  •         It is used for lighting, cooking, air conditioning and working of electrical appliances like T.V., fridge and washing machine.

There are three main sources of power generation:

1. Thermal Power

2. Hydro-electric power

3. Nuclear Power

#Non-Commercial energy Sources:

  •         These sources include fuel wood, straw and dried dung. These are commonly used in rural India.
  •         According to an estimate, the total availability of fuel wood in India was only 50 million tons a year.
  •         It is less than 50% of the total requirements. In coming years, there would be shortage of fire wood.

(a)Firewood:

  •         Firewood is any wooden material that is gathered and used for fuel. 


  •         Firewood can be seasoned (dry) or unseasoned (fresh/wet). It is generally classified as hardwood or softwood. Firewood is a renewable resource.
  •         However, demand for this fuel can outpace its ability to regenerate on a local or regional level.

(b)Straw:

  •         Straw or hay briquettes are a biofuel substitute to coal.

(c)Dry dung:

  •         Dry dung fuel (or dry manure fuel) is animal feces that has been dried in order to be used as a fuel source.
  •         Using dry manure as a fuel source is an example of reuse of excreta.
  •       A disadvantage of using this kind of fuel is increased air pollution.

B. Non-Conventional Resources/Source of Energy: -          

        Besides conventional sources of energy there are non-conventional sources of energy. These are also called renewable sources of energy.

        Examples are Bio energy, solar energy, wind energy and tidal energy.

The various sources are given below:

1. Solar Energy:

  •         Energy produced through the sunlight is called solar energy.
  •         Under this programmed, solar photovoltaic cells are exposed to sunlight and in the form of electricity is produced. Photovoltaic cells are those which convert sun light energy into electricity.
  •         In year 1999-2000, 975 villages were illuminated through solar energy.
  •         Under Solar Thermal Programmed, solar energy is directly obtained. Sunlight is converted into thermal power.
  •         Solar energy is used for cooking, hot water and distillation of water etc.

2. Wind Energy:

  •         This type of energy can be produced by harnessing wind power.
  •         It is used for operating water pumps for irrigation purposes. Approximately 2756 wind pumps were set up for this purpose.
  •         In seven states, wind power operated power houses were installed and their installed capacity was 1000 MW.
  •         India has second position in wind power energy generation.

3. Tidal Energy:

  •         Energy produced by exploiting the tidal waves of the sea is called tidal energy.
  •         Due to the absence of cost effective technology, this source has not yet been tapped.

4. Bio Energy:

  • This type of energy is obtained from organic matter.

It is of two kinds:

(i) Bio Gas:

  •         Bio Gas is obtained from Gobar Gas Plant by putting cow dung into the plant. Besides producing gas this plant converts gobar into manure.
  •         It can be used for cooking, lighting and generation of electricity. 26.5 lakh bio gas plants had been established by the year 2003-04.
  •         They produce more than 225 lakh tonnes of manure. About 1828 large community bio gas plants have been established in the country.

(ii) Bio Mass:

  •         It is also of a source of producing energy through plants and trees.
  •         The purpose of bio mass programmed is to encourage afforestation for energy.
  •         So that fuel for the generation of energy based on gas technique and fodder for the cattle could be obtained, 56 MW capacity for the generation of bio mass energy has been installed.

5. Energy from Urban Waste:

  •         Urban waste poses a big problem for its disposal. Now it can be used for generation of power.
  •         In Timarpur (Delhi) a power Ration of 3.75 capacity has been set up to generate energy from the garbage.
  Thanks For Visiting in Our Blog I hope this Post helps you...!

On May 28, 2021 by Flare Study   No comments

 Hello in this Article "we will discuss all Phases of Compiler Design and we will also Provide Complete Notes of Compiler Design " .

The Phases of Compiler are given Below:

     The Phases of compiler divided in to two parts, first three phases we are called as Analysis part remaining three called as Synthesis part.


  1. In some applications we may have a compiler called pass.
  2. Where there is a collection of nearby steps that converts the input from one representation to one Fully deferred representation.
  3. Each pass performs a complete scan of input and produces
  4. Its output will be processed from a later pass. For example, a two-pass assembler.

Now we Move to Our all Phases:

1) Lexical Analyzer 

2) Syntax Analyzer    

3) Semantic Analyzer

4) Intermediate Code Generator

5) Code Optimizer

6) Code Generator

and other some topics Like:-

    - Symbol Table

    - error Handler


On May 12, 2021 by Flare Study   No comments

Hello in this Article "we will discuss about how to install Linux terminal" for your College practical's 

In this you can easily run your Linux Command





In above video i will discuss all Questions Listed below:

  1. How to install linux Terminal.
  2. How to install Ubuntu 18.04 on windows 10. 
  3. How to remove dpkg error in ubuntu.
  4. Why ubuntu takes more time to boot.
  5. How to remove "WslRegisterDistribution failed with error 0x8007019e and 0x8000000d – WSL".

How To solve 

"Installing, this may take a few minutes…

WslRegisterDistribution failed with error: 0x8007019e/0x8000000d

Error: 0x8007019e/0x8000000d The parameter is incorrect.

Press any key to continue" this error.

and One More:

  • How to on Subsystem for Linux.

if you need this all process then you will easy to dawnload this file 

Link: https://flarealstudy.blogspot.com/2021/05/download-linux-terminal-installation.html

Copy this Command:"Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"


Thanks for Watching