Software Development Exam  >  Software Development Tests  >  Test: Numerical Methods - 1 - Software Development MCQ

Test: Numerical Methods - 1 - Software Development MCQ


Test Description

15 Questions MCQ Test - Test: Numerical Methods - 1

Test: Numerical Methods - 1 for Software Development 2024 is part of Software Development preparation. The Test: Numerical Methods - 1 questions and answers have been prepared according to the Software Development exam syllabus.The Test: Numerical Methods - 1 MCQs are made for Software Development 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Numerical Methods - 1 below.
Solutions of Test: Numerical Methods - 1 questions in English are available as part of our course for Software Development & Test: Numerical Methods - 1 solutions in Hindi for Software Development course. Download more important topics, notes, lectures and mock test series for Software Development Exam by signing up for free. Attempt Test: Numerical Methods - 1 | 15 questions in 30 minutes | Mock test for Software Development preparation | Free important questions MCQ to study for Software Development Exam | Download free PDF with solutions
Test: Numerical Methods - 1 - Question 1

What is the time complexity of the binary search algorithm?

Detailed Solution for Test: Numerical Methods - 1 - Question 1

Binary search has a time complexity of O(log n) as it divides the search space in half at each step.

Test: Numerical Methods - 1 - Question 2

Which of the following methods is used to find the square root of a number?

Detailed Solution for Test: Numerical Methods - 1 - Question 2

Newton's Method is commonly used to find the square root of a number.

1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Numerical Methods - 1 - Question 3

 

Which numerical method is used to find the approximate value of a definite integral?

Detailed Solution for Test: Numerical Methods - 1 - Question 3

Simpson's Rule is a numerical method used to approximate the value of a definite integral.

Test: Numerical Methods - 1 - Question 4

Which numerical method can be used to solve a system of linear equations?

Detailed Solution for Test: Numerical Methods - 1 - Question 4

Gauss-Jordan Elimination is a numerical method used to solve a system of linear equations.

Test: Numerical Methods - 1 - Question 5

What is the main advantage of using Ternary Search over Binary Search?

Detailed Solution for Test: Numerical Methods - 1 - Question 5

Ternary Search is particularly useful for finding the maximum or minimum point in a unimodal function.

Test: Numerical Methods - 1 - Question 6

What will be the output of the following code?
#include <iostream>
using namespace std;

int binarySearch(int arr[], int target, int low, int high) {
    while (low <= high) {
        int mid = low + (high - low) / 2;
        if (arr[mid] == target) {
            return mid;
        } else if (arr[mid] < target) {
            low = mid + 1;
        } else {
            high = mid - 1;
        }
    }
    return -1;
}

int main() {
    int arr[] = {2, 5, 7, 10, 15};
    int target = 7;
    int n = sizeof(arr) / sizeof(arr[0]);
    int result = binarySearch(arr, target, 0, n - 1);
    cout << "Result: " << result << endl;
    return 0;
}

Detailed Solution for Test: Numerical Methods - 1 - Question 6

The code performs a binary search to find the index of the target element in the given array. In this case, the target is 7, which is present at index 2 of the array.

Test: Numerical Methods - 1 - Question 7

What will be the output of the following code?
#include <iostream>
using namespace std;

double squareRoot(double x) {
    double low = 0.0, high = x, mid;
    while (high - low > 1e-9) {
        mid = low + (high - low) / 2;
        if (mid * mid > x) {
            high = mid;
        } else {
            low = mid;
        }
    }
    return low;
}

int main() {
    double num = 16.0;
    double result = squareRoot(num);
    cout << "Result: " << result << endl;
    return 0;
}

Detailed Solution for Test: Numerical Methods - 1 - Question 7

The code implements the square root function using a binary search approach. It finds the square root of 16.0, which is 4.0, and the output is rounded to 2 decimal places.

Test: Numerical Methods - 1 - Question 8

What will be the output of the following code?
#include <iostream>
using namespace std;

double ternarySearch(double low, double high, double target) {
    while (high - low > 1e-9) {
        double leftThird = low + (high - low) / 3;
        double rightThird = high - (high - low) / 3;
        if (f(leftThird) < f(rightThird)) {
            low = leftThird;
        } else {
            high = rightThird;
        }
    }
    return low;
}

double f(double x) {
    return x * x * x - 4 * x + 1;
}

int main() {
    double result = ternarySearch(-1000, 1000, 0);
    cout << "Result: " << result << endl;
    return 0;
}

Detailed Solution for Test: Numerical Methods - 1 - Question 8

The code uses ternary search to find the root of the equation 'f(x) = x^3 - 4x + 1' near the value 0. The output is rounded to 10 decimal places.

Test: Numerical Methods - 1 - Question 9

Which of the following problems can be efficiently solved using Binary Search?

Detailed Solution for Test: Numerical Methods - 1 - Question 9

Binary Search can efficiently find the position of a specific value in a sorted array, but it cannot determine the number of occurrences of that value.

Test: Numerical Methods - 1 - Question 10

Consider an array of integers where each element appears twice except for one element that appears only once. How can you efficiently find the element that appears only once using Binary Search?

Detailed Solution for Test: Numerical Methods - 1 - Question 10

XOR operation can be used to find the element that appears only once in an array where all other elements appear twice.

Test: Numerical Methods - 1 - Question 11

Which of the following is a disadvantage of using Newton's Method for finding roots of equations?

Detailed Solution for Test: Numerical Methods - 1 - Question 11

Newton's Method requires the function to be continuous and differentiable for it to work properly.

Test: Numerical Methods - 1 - Question 12

Which of the following is an advantage of using Ternary Search over Binary Search for finding the maximum or minimum point in a unimodal function?

Detailed Solution for Test: Numerical Methods - 1 - Question 12

Ternary Search can be used to find the maximum or minimum point in a unimodal function, which can be non-monotonic.

Test: Numerical Methods - 1 - Question 13

What will be the output of the following code?
#include <iostream>
using namespace std;

int binarySearch(int arr[], int target, int low, int high) {
    if (low <= high) {
        int mid = low + (high - low) / 2;
        if (arr[mid] == target) {
            return mid;
        } else if (arr[mid] < target) {
            return binarySearch(arr, target, mid + 1, high);
        } else {
            return binarySearch(arr, target, low, mid - 1);
        }
    }
    return -1;
}

int main() {
    int arr[] = {2, 5, 7, 10, 15};
    int target = 7;
    int n = sizeof(arr) / sizeof(arr[0]);
    int result = binarySearch(arr, target, 0, n - 1);
    cout << "Result: " << result << endl;
    return 0;
}

Detailed Solution for Test: Numerical Methods - 1 - Question 13

The code performs a recursive binary search to find the index of the target element in the given array. In this case, the target is 7, which is present at index 2 of the array.

Test: Numerical Methods - 1 - Question 14

What will be the output of the following code?
#include <iostream>
using namespace std;

double squareRoot(double x) {
    double low = 0.0, high = x, mid;
    while (high - low > 1e-9) {
        mid = low + (high - low) / 2;
        if (mid * mid > x) {
            high = mid;
        } else {
            low = mid;
        }
    }
    return low;
}

int main() {
    double num = 9.0;
    double result = squareRoot(num);
    cout << "Result: " << result << endl;
    return 0;
}

Detailed Solution for Test: Numerical Methods - 1 - Question 14

The code implements the square root function using a binary search approach. It finds the square root of 9.0, which is 3.0, and the output is rounded to 1 decimal place.

Test: Numerical Methods - 1 - Question 15

What will be the output of the following code?
#include <iostream>
using namespace std;

double ternarySearch(double low, double high, double target) {
    while (high - low > 1e-9) {
        double leftThird = low + (high - low) / 3;
        double rightThird = high - (high - low) / 3;
        if (f(leftThird) < f(rightThird)) {
            low = leftThird;
        } else {
            high = rightThird;
        }
    }
    return low;
}

double f(double x) {
    return x * x * x - 4 * x + 1;
}

int main() {
    double result = ternarySearch(-1000, 1000, 1);
    cout << "Result: " << result << endl;
    return 0;
}

Detailed Solution for Test: Numerical Methods - 1 - Question 15

The code uses ternary search to find the root of the equation 'f(x) = x^3 - 4x + 1 near the value 1'. The output is rounded to 10 decimal places.

Information about Test: Numerical Methods - 1 Page
In this test you can find the Exam questions for Test: Numerical Methods - 1 solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Numerical Methods - 1, EduRev gives you an ample number of Online tests for practice

Top Courses for Software Development

Download as PDF

Top Courses for Software Development