Book Your slot
X
ONLINE BOOKING
BOOK NOW
OFFLINE BOOKING
Call or WhatsApp 7993732682 (WhatsApp Now), 9177341827 (WhatsApp Now)
search
Menu Login home
  • Questions

  • Library

  • University Updates

  • Informatives

  • Technology Lines

  • Training & Internships

  • X
    Menu
  • Home
  • Privacy Policy
  • Legal Disclaimer
  • Terms & Conditions
  • Return Policy
  • About Us
  • Need any help?? write to us at

    support@engineershub.co

    Follow Us

    X
    LOGIN
    Login to access posts, links, updates, question papers, materials, one liners!
    Use Your Email Address/Mobile and Password to Login
    Forgot Password?
    Not a member? Sign Up
    LOGIN WITH EMAIL/MOBILE
    Forgot Password?
    Go Back
    FORGOT PASSWORD
    Go Back
    RESET PASSWORD
    Go Back
    Continue with LinkedIn
    OR
    Fill Up a Simple Form
    Already a Member? Login
    SIGN UP
    Fill all the below details correctly and click on Next
    Go Back
    Technology - Tag - questions - EngineersHub
    Tag results found for "Technology" in Questions.
    Question
    Anvesh Kanchibhotla
    1 month ago
    1 Answer(s) posted Write an answer 376
    Answer
    Read Mode
    Answer posted by Deepa
    1 month ago

    C supports a number of string handling functions. All of these built-in functions are aimed at performing various operations on strings are in the header file string.in.

    (i).strlen( )

    This function is used to find the length of the string excluding the NULL character. In other words, this function is used to cout the number of character in a string. Its syntax is as follows:

                                                                            Int strlen(string);

     Example: char str1[ ]="WELLCOME";

                       int n;

                       n =strlen(str1);

    /* A program to caculate length of string by using stren() function */

    #include<stdio.h>

    main()

    {

    char string1[50];

    int length;

    printf("\n Enter any string:");

    gets(string1);

    length=strlen(string1);

    printf("\n The length of string=%d",length);

    }

    (ii). strcpy( )

    This function is used to copy one string to  the other. Its syntax is as follows:

                                                                     strcpy(strings1,strings2);

    Where string1 and string2 are one -dimmensional character arrays.

                               This function copies the content of strings2 to string1.

                           E.g.,string1 contains master and string2 contains madam, then string1 holds madam after execution of strcpy (string1,string2) function.

    Example :         char str1[ ] ="WELLCOME";

                               char str2[ ]="HELLO";

                                strcpy(str1,str2);

    /* A program to copy one string to another using strcpy( ) function */

        #include<stdio.h>

        #include<string.h>

        main( )

        {

        char string1[30],string2[30];

        printf("\n Enter first string:");

         gets(string1);

         printf("\n Enter second string:");

         gets(string2)

         strcpy(string1,string2);

         printf("\n first string=%s",string1);

         printf("\n second string=%s",string2);

    }

     (iii).strcmp( )

       This function compares two stings characters by character b(ASCII comparison) and returns one

    of three values {-1,0,1}. The umeric difference is'0' if string are equal. If it is negative string1 is alphabitically above string2.. If it is positive string2 is alphabetically above string1.

                                 Its syntax is as follows:

                                                                                            int strcmp(string1,string2);

    Example:     char str1[ ]="ROM";

                          char str2[ ]="RAM";

                          strcmp(str1,str2);

                           (or)

                            strcmo("ROM","RAM");

    /* a program to compare two strings using strcmp() function */

    #incudestdio.h>

    #include<string.h>

    main()

    {

    char string1[30],string2[15];

    int x;

    prinf(""\n Enter first string:");

    gets(string1);

    printf("\n Enter seond string:");

    gets(strings2);

    x= strcmp(string1,string2);

    if(x==0)

    printf("\nBoth strings are equal");

    else if(x>0)

    printf("\n first string is bigger");

    else

    printf("\n second  string is bigger");

    }

    (iv). strcat ( )

    This fuction is used to concatenate two strings. i.e.,it appends one string at the end of the specified string.Its syntax as follows:

                                                                    strcat(string1,string2);

    where string1 and string2 are one-dimensional character arrays.

                                            This  function joins two strings together. In other words, its adds the string2 to string1 and the strings1 contains  the concatenatted string. E.g.,string1 contains prog and string2 contains  ram , then string1 holds program after execution of  the strcat( ) function. 

                                Example:    char str1[10] = "VERY";

                                                     char str2[5] = "GOOD";

                                                     strcat(str1,str2);

    /* A program to concatenate one string with another using stracat( ) function */

    #include<strdio.h>

    #include<string.h>

    main( )

    char string1[30],string2[15];

    printf("\n Enter first string:");

    gets(string1);

    printf("\n Enter second string:");

    gets(strings2);

    strcat(string1,string2);

    printf("\n concatenated string=%s",string1);

    }

    15
    Question
    Vamshi
    1 month ago
    1 Answer(s) posted Write an answer 258
    Answer
    Read Mode
    Answer posted by SaiMukesh Reddy
    3 weeks ago

    Reading and Writing strings:-

    C language provides several string handling functions for input and output.

    String Input/Output Functions:-

    C provides two basic methods to read and write strings. Using formatted input/output functions and using a special set of functions.

    Reading strings from the terminal:-

    (a) formatted input function:- scanf can be used with %s format specification to read a string.

    Ex:- char name[10];

    scanf(“%s”,name);

    Here don‘t use‘&’ because the name of the string is a pointer to the array. The problem with scanf is that it terminates its input on the first white space it finds.

    Ex:- NEW YORK

    Reads only NEW (from above example).

    (b) Unformatted input functions:-

    (1) getchar():- It is used to read a single character from the keyboard. Using this function repeatedly we may read an entire line of text

    Ex:- char ch=‘z’;

    ch=getchar();

    (2) gets():- It is a more convenient method of reading a string of text including blank spaces.

    Ex:- char line[100];

    gets(line);

    Writing strings on to the screen:-

    (1) Using formatted output functions:- printf with %s format specifier we can print strings in different formats on to screen.

    Ex:- char name[10];

    printf(“ s ”,name);

    Ex:- char name[10];

    printf(“0.4”,name);   

    J A N U

    /* If name is JANUARY prints only 4 characters ie., JANU */

    Printf(“10.4”,name);

                J A N U

    printf(“-10.4”,name);

    J A N U            

    (2) Using unformatted output functions:-

    (a) putchar():- It is used to print a character on the screen.

    Ex:- putchar(ch);

    (b) puts():- It is used to print strings including blank spaces.

    Ex:- char line[15]=“Welcome to lab”;

    puts(line);

    7
    Question
    Akhil Kumar Lakum
    1 month ago
    1 Answer(s) posted Write an answer 253
    Answer
    Read Mode
    Answer posted by SaiMukesh Reddy
    3 weeks ago

    C Strings:-

    In C language a string is group of characters (or) array of characters, which is terminated by delimiter \0 (null). Thus, C uses variable-length delimited strings in programs.

    Declaring Strings:-

    C does not support string as a data type. It allows us to represent strings as character arrays. In C, a string variable is any valid C variable name and is always declared as an array of characters.

    Syntax:- char string name[size];

    The size determines the number of characters in the string name.

    Ex:- char city[10];

    char name[30];

    Initializing strings:-

    There are several methods to initialize values for string variables.

    Ex: - char city [8] = “NEWYORK”;

    char city [8] = {“N”,“E”,“W”,“Y”,“O”,“R”,“K”,“/0”};

    The string city size is 8 but it contains 7 characters, and one-character space is for the NULL terminator.

    Storing strings in memory: -

    In C a string is stored in an array of characters and terminated by \0 (null).

    A string is stored in an array, the name of the string is a pointer to the beginning of the string. The character requires only one memory location.

    If we use a one-character string it requires two locations. The difference is shown below,

    The difference between array and string is shown below because strings are the variable-length structure, we must provide enough room for maximum length string to store and one byte for the delimiter.

    Why do we need null?

    A string is not a datatype but a data structure. String implementation is logical, not physical. The physical structure is an array in which the string is stored. The string is variable-length, so we need to identify the logical end of data in that physical structure.

    string constant (or) Literal:-

    A string constant is a sequence of characters enclosed in double-quotes. When string constants are used in the C program, it automatically initializes a null at end of the string.

    Ex:- “Hello”     “Welcome”      “Welcome to C Lab”

    4
    Question
    Anandam Lokesh
    1 month ago
    1 Answer(s) posted Write an answer 224
    Answer
    Read Mode
    Answer posted by Venu Gopal reddy Seelam
    1 month ago

    /* ADDITION OF TWO MATRICES*/

    #include<stdio.h>

    #include<conio.h>

    #include<process.h>

    void main( )

    {

    int a[10][10],b[10][10],c[10][10];

    int i,j,m,n,p,q;

    printf("\n Enter the size of matrix A:");

    scanf("%d%d",&m,&n);

    printf("\n Enter the size of Matrix B:");

    scanf("%d%d",&p,&q);

    if(m!=p||n!=q)

           {

                printf("Matrix addition not possible.");

                 exit(0);

           }

    printf(" Enter the matrix B values:\n");

    for(i=0;i<m;i )

                          for(j=0;j<n;j )

                          scanf("%d",&a[i][j]);

    print("Enter the Matrix B values:\n");

    for(i=0;i<p;i )

                 for(j=0;j<n;j )

                  c[i][j]=a[i][j] b[i][j];

    printf("\n The Matrix A is \n");

    for(i=0;i<m;i )

                    {

                        for(j=0;j<n;j )

                        printf('%d",a[i][j]);

                        print("\n");

                     }

    printf("\n The Martix B is\n");

    for(i=0;i<p;i )

                {

                for(j=0;j<q;b[i][j]);

                printf("%d",b[i][j]);

                printf("\n");

                }

    printf("\n The  Output Matrix C is\n");

    for(i=0;i<m;i )

                 {

                 for(j=0;j<n;j )

                 printf("%d",c[i][j]);

                 printf("\n");

                 }

    }

    OUTPUT :

           Enter the size of Matrix A:2

            3

           Enter the size of Matrix B:2

            3

            Enter the matrix A values:

             1

             2

             3

             4

             5

             6

              Enter the Matrix B values:

              6

              5

              4

              3

              2

              1

     The Matrix A is

    1 2 3

    4 5 6

    The matrix B is

    6 5 4

    3 2 1

    The Output Matrix C is

    7 7 7

    7 7 7

    49
    Question
    Arunbavu Arun
    1 month ago
    1 Answer(s) posted Write an answer 238
    Answer
    Read Mode
    Answer posted by Anvesh Kanchibhotla
    3 weeks ago

    Multidimensional arrays are often known as an array of arrays. In multidimensional arrays, the array is divided into rows and columns, mainly while considering multidimensional arrays we will be discussing mainly about two-dimensional arrays and a bit about three-dimensional arrays.

    Syntax: data_type array_name[size1][size2][size3]------[sizeN];

    In 2-D array we can declare an array as :

    int arr[3][3] = { 1, 2, 3,

                           4, 5, 6,

                          7, 8, 9

                     };

    where the first index value shows the number of the rows and the second index value shows the number of the columns in the array. To access the various elements in a 2-D array we can use:

    printf("%d", a[2][3]);

    /* output will be 6, as a[2][3] means the third element of the second row of the array */

    In 3-D we can declare the array in the following manner :

    int arr[3][3][3] =

    { 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

      };

    /* here we have divided array into the grid for sake of convenience as in above declaration we have created 3 different grids, each has rows and columns */

    If we want to access the element in a 3-D array we can do it as follows :

    printf("%d",a[2][2][2]);

    /* its output will be 26, as a[2][2][2] means first value in [ ] corresponds to the grid no. i.e. 3 and the second value in [ ] means the third row in the corresponding grid and last [ ] means the third column */

    Ex:- int arr[3][5][12];

                     float table[5][4][5][3];

    arr is a 3D array declared to contain 180 (3*5*12) int type elements. Similarly, the table is a 4D array containing 300 elements of float type.

    4
    Question
    Arunbavu Arun
    1 month ago
    1 Answer(s) posted Write an answer 292
    Answer
    Read Mode
    Answer posted by Ruchitha
    3 weeks ago

    These are stored in the memory as given below.

    1) Row-Major order Implementation

    2) Column-Major order Implementation

    In Row-Major Implementation of the arrays, the arrays are stored in the memory in terms of the row design, i.e. first the first row of the array is stored in the memory then second, and so on.

    Suppose we have an array named arr having 3 rows and 3 columns then it can be stored in the memory in the following manner :

    int arr[3][3];

    Thus an array of 3*3 can be declared as follows :

    arr[3][3] = { 1, 2, 3,

                      4, 5, 6,

                      7, 8, 9 };

    and it will be represented in the memory with row-major implementation as follows :

    In Column-Major Implementation of the arrays, the arrays are stored in the memory in the term of the column design, i.e. the first column of the array is stored in the memory than the second, and so on. By taking the above eg. we can show it as follows :

    arr[3][3] = { 1, 2, 3,

                      4, 5, 6,

                      7, 8, 9 };

    and it will be represented in the memory with column-major implementation as follows :

    Two-dimensional arrays of variable length

    An array consisting of two subscripts is known as a two-dimensional array. These are often known as an array of the array. In two-dimensional arrays, the array is divided into rows and columns,.

    These are well suited to handle the table of data. In a 2-D array, we can declare an array as :

    Declaration:-

    Syntax: data_type array_name[row_size][column_size];

    Ex: int arr[3][3] ;

    Where first index value shows the number of the rows and the second index value shows the no. of the columns in the array.

    These are stored in the memory as given below.

    Initialization:-

    To initialize values for variable-length arrays we can use scanf statement and loop constructs.

    Ex:-

    for ( i=0 ; i<3; i++ )

    for( j=0;j<3;j++ )

    scanf( “ %d ”,&arr[i][j] );

    5
    Question
    Ruchitha
    1 month ago
    1 Answer(s) posted Write an answer 231
    Answer
    Read Mode
    Answer posted by Vinod Raj
    1 month ago

    Array:-

    An array is defined as an ordered set of similar data items. All the data items of an array are stored in consecutive memory locations in RAM. The elements of an array are of same data type and each item can be accessed using the same name.

    Declaration of an array:-

    We know that all the variables are declared before they are used in the program. Similarly, an array must be declared before it is used. During declaration, the size of the array has to be specified. The size used during declaration of the array informs the compiler to allocate and reserve the specified memory locations.

    Syntax:- data_type array_name[n];

    where, n is the number of data items (or) index(or) dimension.

    0 to (n-1) is the range of array.

    Ex: int a[5];

              float x[10];

    Initialization of Arrays:-

    The different types of initializing arrays:

    1. At Compile time

    (i) Initializing all specified memory locations.

    (ii) Partial array initialization

    (iii) Initialization without size.

    (iv) String initialization.

    2. At Run Time

    1. Compile Time Initialization:  We can initialize the elements of arrays in the same way as the ordinary variables when they are declared. The general form of initialization of arrays is 

    type array-name[size]={ list of values};

    (i) Initializing all specified memory locations:- Arrays can be initialized at the time of declaration when their initial values are known in advance. Array elements can be initialized with data items of type int, char etc.

    Ex:- int a[5]={10,15,1,3,20};

    During compilation, 5 contiguous memory locations are reserved by the compiler for the variable a and all these locations are initialized as shown in figure.

    Fig: Initialization of int Arrays

    Ex:- int a[3]={9,2,4,5,6}; //error: no. of initial vales are more than the size of array.

    (ii) Partial array initialization:- Partial array initialization is possible in c language. If the number of values to be initialized is less than the size of the array, then the elements will be initialized to zero automatically. 

    Ex:- int a[5]={10,15};

    Even though compiler allocates 5 memory locations, using this declaration statement; the compiler initializes first two locations with 10 and 15, the next set of memory locations are automatically initialized to 0's by compiler as shown in figure.

    Fig: Partial Array Initialization

    Initialization with all zeros:-

    Ex:- int a[5]={0};

    (iii) Initialization without size:-

    Consider the declaration along with the initialization.

    Ex:- char b[]={'C','O','M','P','U','T','E','R'};

    In this declaration, eventhough we have not specified exact number of elements to be used in array b, the array size will be set of the total number of initial values specified. So, the array size will be set to 8 automatically. The array b is initialized as shown in figure.

    Fig: Initialization without size

    Ex:- int ch[]={1,0,3,5} // array size is 4

    (iv) Array initialization with a string: -Consider the declaration with string initialization.

    Ex:- char b[]="COMPUTER";

    The array b is initialized as shown in figure.

    Fig: Array Initialized with a String

    Even though the string "COMPUTER" contains 8 characters, because it is a string, it always ends with null character. So, the array size is 9 bytes (i.e., string length 1 byte for null character).

    Ex:-                                                                              char b[9]="COMPUTER"; // correct

    char b[8]="COMPUTER"; // wrong

    2. Run Time Initialization

    An array can be explicitly initialized at run time. This approach is usually applied for initializing large arrays.

    Ex:- scanf can be used to initialize an array.

    int x[3];

    scanf(%u201C%d%d%d%u201D,&x[0],&x[1],&x[2]);

    The above statements will initialize array elements with the values entered through the key board.

    (Or)

    for(i=0;i<100;i=i 1)

    {

    if(i<50)

    sum[i]=0.0;

    else

    sum[i]=1.0;

    }

    The first 50 elements of the array sum are initialized to 0 while the remaining 50 are initialized to 1.0 at run time.

    7
    Question
    Venu Gopal reddy Seelam
    7 months ago
    1 Answer(s) posted Write an answer 469
    Answer
    Read Mode
    Answer posted by Anvesh Kanchibhotla
    2 days ago
    • In java, it is illegal to declare two local variables with the same name inside the same or enclosing scopes.
    • But you can have formal parameters to methods, which overlap with the names of the class' instance variables.
    • this keyword is used to refer to the current object.
    • this can be used to resolve any name collisions that might occur between instance variables and formal variables.
    • When a formal variable has the same name as an instance variable, the formal variable hides the instance variable.
    •  Also used in method chaining and constructor chaining.

    // instance and formal variables are different

    class Box{
      double w=5,h=5,d=5;
      Box(double w1,double h1,double d1){
          w=w1;
          h=h1;
          d=d1;
      }
      double volume(){
          return w*h*d;
      }
     }
     class BoxTest1{
       public static void main(String args[]){
           Box b=new Box(1,2,3);
           System.out.println("Volume is: " b.volume());
      }
     }
    

    Output:
    Volume is: 6.0

    // instance and formal variables are same
     

    class Box{
       double w=5,h=5,d=5;
       Box(double w,double h,double d){
            w=w;
            h=h;
            d=d;
       }
       double volume(){
            return w*h*d;
       }
      }
      class BoxTest2{
        public static void main(String args[]){
             Box b=new Box(1,2,3);
             System.out.println("Volume is: " b.volume());
       }
      }
    

    Output:
    Volume is:125.0
     

    // 'this' hides the instance variables

    class Box{
       double w=5,h=5,d=5;
       Box(double w,double h,double d){
           this.w=w;
           this.h=h;
           this.d=d;
     }
      double volume(){
           return w*h*d;
      }
     }
     class BoxTest2{
       public static void main(String args[]){
          Box b=new Box(1,2,3);
          System.out.println("Volume is: " b.volume());
      }
     }
    

    Output:
    Volume is:6.0

     

    // method chaining

    class Fchain{ 
            int a,b;
            Fchain setValue(int x,int y){
                    a=x;
                    b=y;
                    return this;
            }
            Fchain disp(){
                   System.out.println("a value is:" a);
                   System.out.println("b value is:" b);
                   return this;
            }
     }
     class FchainDemo{
            public static void main(String args[]){
            Fchain f1=new Fchain();
            f1.setValue(10,20).disp().setValue(11,22).disp();
            }
     }
    
    

    //Constructor Chaining

    class Test{
             int a,b,c,d;
             Test(int x,int y){
                       a=x;
                       b=y;
             }
              Test(int x,int y,int z){
                       this(x,y);
                       c=z;
             }
             Test(int p,int q,int r,int s){
                       this(p,q,r);
                       d=s;
             }
              void disp(){
         System.out.println(a %u201D %u201D b %u201D %u201D c %u201D %u201D d);
             }
     }
    
    
     class TestDemo{
          public static void main(String args[]){
              Test t1=new Test(10,20,30,40);
              t1.disp();
              }
     }

    2
    Question
    Venu Gopal reddy Seelam
    7 months ago
    0 Answer(s) posted Write an answer 465
    Question
    SaiMukesh Reddy
    9 months ago
    1 Answer(s) posted Write an answer 768
    Answer
    Read Mode
    Answer posted by Anandam Lokesh
    9 months ago
    • R is a flexible and powerful open-source implementation of the language S (for statistics) developed by John Chambers and others at Bell Labs.

           Why R?
           Five reasons to learn and use R:

    • R is open source and completely free. R community members regularly contribute packages to increase R's functionality.
    • R is as good as commercially available statistical packages like SPSS, SAS, and Minitab.
    • R has extensive statistical and graphing capabilities. R provides hundreds of built-in statistical functions as well as its own built-in programming language.
    • R is used in teaching and performing computational statistics. It is the language of choice for many academics who teach computational statistics.
    • Getting help from the R user community is easy. There are readily available online tutorials, data sets, and discussion forums about R.           

           R uses: 

    • R combines aspects of functional and object-oriented programming.
    • R can use in interactive mode
    • It is an interpreted language rather than a compiled one.
    • Finding and fixing mistakes is typically much easier in R than in many other languages.

          R Features:-

    • Programming language for graphics and statistical computations
    • Available freely under the GNU public license
    • Used in data mining and statistical analysis
    • Included time series analysis, linear and nonlinear modeling among others
    • Very active community and package contributions
    • Very little programming language knowledge necessary
    3
    Question
    Anandam Lokesh
    9 months ago
    1 Answer(s) posted Write an answer 922
    Answer
    Read Mode
    Answer posted by KURVA SHEKER
    9 months ago

    GPU stands for Graphics Processing Unit which is used to manipulate 3D graphics, multimedia and images. The major aim of this concept is to free up the processor from processing tasks associated with graphics by handling these tasks in the graphic card itself. This can be done by implementing GPU as a coprocessor on the video card.

    It was first developed by NVIDIA in 1999 which was named as GeForce 256 that is capable of handling 10 million polygons within a single second. This feature was made to be used in almost all computers today. It is designed in such a way that it processes multiple threads simultaneously providing massive parallelism. Modern GPUs are capable of processing 1024 concurrent threads. They highly depend on providing increased throughput at chip-level.z

    With improvements in GPU technology, they are used in processing floating point operations and data-intensive calculations apart from processing graphics. For this reason they are now used in mobile phones, gaming consoles, personal computers and many other fields.

    Fermi GPU: Fermi based GPU has the following advantages,

    1.It has improved memory access and double precious floating performance.

    2.It supports ECC.

    3. It generates cache hierarchy.

    4. It shares memory among streaming.

    5.It performs faster context switching, atomic operation and instruction scheduling.

    6.It uses a prediction method inorder to reduce branch penalty.

    Fermi GPU consists of the following components,

    1. 3.0 billion transistors. 

    2. 512 cores arranged on 16 bit stream multiprocessor of 32 cores each which in turn are shared by L, cache. The function of these core is to execute floating point or integer instructions per clock.

    3. 384 bit (i.es 6X64) DRAM interface is provided by GPU chip for supporting a total of 6 GB memory.

    4. PCI express (host interface) in order to connect GPU to CPU.

    5. Giga Thread Unit (GT) to schedule a group of thread among Streaming Multiprocessor (SM).

           In addition to 32-cores, Stream Multiprocessor (SM) also consists of 16 load/store unit and four independent Special Functional Unit (SFU) in order to perform mathematical functions like sine, cosine, reciprocal and square root. The 32 core inturn are provided with Arithmetic Logical Unit (ALU) and Floating Point Units (FLU's).

    17

    Users Joined

    Varsha
    37 minutes ago
    swarnalatha
    1 hour ago
    nandini
    1 day ago
    Sabbasanianilreddt
    1 day ago
    Akshay
    1 day ago
    EngineersHub Logo
    x
    Loading...