Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

SIKSHAPATH

SIKSHAPATH Logo SIKSHAPATH Logo

SIKSHAPATH Navigation

  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
  • About
    1. Asked: January 17, 2022In: Data Science

      What will be the output of the following R code? * m <- matrix( nrow = 2, ncol = 3) …

      I'M ADMIN
      I'M ADMIN
      Added an answer on January 17, 2022 at 7:33 pm

      OUTPUT : 2 3

      OUTPUT : 2 3

      See less
        • 1
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
    2. Asked: January 14, 2022In: Data Science

      vector is given: vtr =c(2,4,5,6,7,1,10) a) how to find length of vector b) to sort the vector in decreasing order …

      I'M ADMIN
      I'M ADMIN
      Added an answer on January 15, 2022 at 10:58 pm

      a) how to find length of vector CODE: vtr =c(2,4,5,6,7,1,10) vl = length(vtr) print("Vector length:") print(vl) b) to sort the vector in decreasing order CODE: vtr =c(2,4,5,6,7,1,10) #sort in decreasing order sort(vtr, decreasing=TRUE) c) to replace the third index value with 9 CODE: vtr =c(2,4,5,6,Read more

      a) how to find length of vector
      
      CODE:
      
      vtr =c(2,4,5,6,7,1,10)
      
      vl = length(vtr)
      
      print("Vector length:")
      
      print(vl)
      
      
      b) to sort the vector in decreasing order
      
      CODE:
      
      vtr =c(2,4,5,6,7,1,10)
      
      #sort in decreasing order
      sort(vtr, decreasing=TRUE)
      
      
      c) to replace the third index value with 9
      
      CODE:
      
      vtr =c(2,4,5,6,7,1,10)
      r1<-replace(vtr,3,"9")
      print(r1)
      
      d) to add one more element at the end of vector.
      
      CODE:
      
      vtr =c(2,4,5,6,7,1,10)
      addnew<-append(vtr,40)
      print(addnew)
      
      e) To print all elements except first element of a vector.
      
      CODE:
      
      vtr =c(2,4,5,6,7,1,10)
      new<-vtr[-1]
      print(new)
      See less
        • 0
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
    3. Asked: January 13, 2022In: Programming Language

      Write a program to find the factorial of a number using function in C.

      I'M ADMIN
      Best Answer
      I'M ADMIN
      Added an answer on January 15, 2022 at 3:15 pm

      #include <stdio.h> int main() {     int n, i;     unsigned long long fact = 1;     printf("Enter an integer: ");     scanf("%d", &n);     // shows error if the user enters a negative integer     if (n < 0)         printf("Error! Factorial of a negative number doesn't exist.");     elseRead more

      #include <stdio.h>
      
      int main() {
      
          int n, i;
      
          unsigned long long fact = 1;
      
          printf("Enter an integer: ");
      
          scanf("%d", &n);
      
      
      
      
          // shows error if the user enters a negative integer
      
          if (n < 0)
      
              printf("Error! Factorial of a negative number doesn't exist.");
      
          else {
      
              for (i = 1; i <= n; ++i) {
      
                  fact *= i;
      
              }
      
              printf("Factorial of %d = %llu", n, fact);
      
          }
      
      
      
      
          return 0;
      
      }
      
      
      
      See less
        • 1
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
    4. Asked: January 14, 2022In: Data Science

      Write the function names for a) To concatenate two strings with syntax b) To find out the minimum valued index …

      I'M ADMIN
      I'M ADMIN
      Added an answer on January 15, 2022 at 1:05 am

      a) To concatenate two strings with syntax sol:cat(st1, st2,sep = ' ')   b) To find out the minimum valued index number sol:which.min(x) c) To sort a particular column of a dataset sol: arrange(dataframe,column) d) To check inbuilt datasets in r. sol:data() e) To check the data type of any variaRead more

      a) To concatenate two strings with syntax

      sol:cat(st1, st2,sep = ‘ ‘)

       

      b) To find out the minimum valued index number

      sol:which.min(x)

      c) To sort a particular column of a dataset

      sol: arrange(dataframe,column)

      d) To check inbuilt datasets in r.

      sol:data()

      e) To check the data type of any variable.

      sol:typeof(x)

      See less
        • 1
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
    5. Asked: January 14, 2022In: Data Science

      1)Differentiate between next and break with example. 2)Write a R program to access the element at 3rd column and 2nd …

      I'M ADMIN
      I'M ADMIN
      Added an answer on January 15, 2022 at 1:01 am

      Question 1) A break statement is used inside a loop (repeat, for, while) to stop the iterations and flow the control outside of the loop. The syntax of break statement is: if (test_expression) { break } A next statement is useful when we want to skip the current iteration of a loop without terminatiRead more

      Question 1)
      
      A break statement is used inside a loop (repeat, for, while) to stop the iterations and flow the control outside of the loop.
      
      
      The syntax of break statement is:
      
      if (test_expression) {
      break
      }
      
      
      
      A next statement is useful when we want to skip the current iteration of a loop without terminating it. On encountering next the R parser skips further evaluation and starts next iteration of the loop.
      
      
      
      The syntax of next statement is:
      
      
      
      if (test_condition) {
      next
      }
      
      
      Question 2)
      
      row_names = c("row1", "row2", "row3", "row4")
      col_names = c("col1", "col2", "col3", "col4")
      M = matrix(c(1:16), nrow = 4, byrow = TRUE, dimnames = list(row_names, col_names))
      print("Original Matrix:")
      print(M)
      print("Access the element at 3rd column and 2nd row:")
      print(M[2,3])
      print("Access only the 3rd row:")
      print(M[3,])
      print("Access only the 4th column:")
      print(M[,4])
      
      Question 3)
      R has 6 basic data types.
      
      • character
      • numeric (real or decimal)
      • integer
      • logical
      • complex
       
      • R’s basic data structures include the vector, list, matrix, data frame, and factors. Some of these structures require that all members be of the same data type (e.g. vectors, matrices) while others permit multiple data types (e.g. lists, data frames).
      
      
      
      See less
        • 0
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
    6. Asked: January 14, 2022In: Data Science

      1)Write a R code for armstrong number 2)What will be the output of the following R code? x <- c(“a”, …

      I'M ADMIN
      I'M ADMIN
      Added an answer on January 15, 2022 at 12:49 am

      1) Armstrong number: A number is thought of as an Armstrong number if the sum of its own digits raised to the power number of digits gives the number itself. For example, 0, 1, 153, 370, 371, 407 are three-digit Armstrong numbers and, 1634, 8208, 9474 are four-digit Armstrong numbers and there are mRead more

      1) Armstrong number: A number is thought of as an Armstrong number if the sum of its own digits raised to the power number of digits gives the number itself.

      For example, 0, 1, 153, 370, 371, 407 are three-digit Armstrong numbers and, 1634, 8208, 9474 are four-digit Armstrong numbers and there are many more.

      EXAMPLE:Let’s consider 370 since it is a three-digit number so it could be expressed as: (3*3*3)+(7*7*7)+(0*0*)= 27 +343+0 =370

       

      CODE For Armstrong number:

      {
      num = as.integer(readline(prompt = "Enter a number :"))
      
      rv = 0
      temp = num
      
      while (num > 0) {
      r = num %% 10
      rv = rv + r * r * r
      num= num %/% 10
      }
      
      if (rv == temp)
      {
      print(paste("Number is Armstrong :", rv))
      }
      else{
      print(paste("Number is not Armstrong :", rv))
      }
      }

      2)Output of Following code will be

      “a”

      “b”

      “c”

      “d”

      See less
        • 0
      • Share
        Share
        • Share on WhatsApp
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
    1 … 89 90 91 92 93 … 122

    Sidebar

    store ads

    Stats

    • Questions 1k
    • Answers 1k
    • Posts 149
    • Best Answers 89
    • This Free AI Tool Translates Entire Books in Minute !
    • AI News: 🎬 Hollywood’s AI Studios, 🎓 OpenAI’s Latest Gift to Educators, 🚚 Class8 Bags $22M, 🧠 Google Gemini’s Memory Upgrade
    • AI NEWS: Legal Action Against OpenAI, $16M Paid, & Elon Musk’s Praise from Investor 🤖💰📑 | AI Boosts Cloud Seeding for Water Security 🌱💧
    • AI News: 🎬AI Video Tool Scam Exposed🤯, 🛰️ AI-Powered Drones to Ukraine 😱, Google’s $20M AI Push, Sam Altman Joins SF’s Leadership Team
    • AI News: 🤝 Biden Meets Xi on AI Talks, 💡 Xavier Niel’s Advice for Europe, ♻️ Hong Kong’s Smart Bin Revolution, 🚀 AI x Huawei

    Explore

    • Recent Questions
    • Questions For You
    • Answers With Time
    • Most Visited
    • New Questions
    • Recent Questions With Time

    Footer

    SIKSHAPATH

    Helpful Links

    • Contact
    • Disclaimer
    • Privacy Policy Notice
    • TERMS OF USE
    • FAQs
    • Refund/Cancellation Policy
    • Delivery Policy for Sikshapath

    Follow Us

    © 2021-24 Sikshapath. All Rights Reserved