Computer Programming Language Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Samarthmishra95
S
Samarthmishra95
Community Contributor
Quizzes Created: 1 | Total Attempts: 533
Questions: 10 | Attempts: 533

SettingsSettingsSettings
Computer Programming Language Quiz - Quiz

. Hi,
Seeing you guys so enthusiastic about the preparation for the club recruitment. I have prepared a small quiz as to how you'll be asked during the club about the tech stuff like - C aptitude and logical reasoning and Simple Puzzles - General and Mathematics.
Lastly I added a question which will be necessarily asked in every recruitment so answer that as well.
There is a time limit of 20 mins to keep that in mind.  Don't worry about the points :P Couldn't remove that feature.
Note that : ONLY ONE ATTEMPT IS ALLOWED
Cheers!
Best,
Samarth Mishra


Questions and Answers
  • 1. 

    It's a simple question that'll be asked in every club.Why do you want to join a club? 

  • 2. 

    What is output?# include <stdio.h> void print(int arr[]){   int n = sizeof(arr)/sizeof(arr[0]);   int i;   for (i = 0; i < n; i++)      printf("%d ", arr[i]);} int main(){   int arr[] = {1, 2, 3, 4, 5, 6, 7, 8};   print(arr);   return 0;}

    • A.

      1,2,3,4,5,6,7,8

    • B.

      Compilation Error

    • C.

      1

    • D.

      Runtime Error

    Correct Answer
    C. 1
    Explanation
    The program defines a function called print that takes an array as an argument. Inside the print function, the size of the array is calculated by dividing the total size of the array by the size of each element. Then, a for loop is used to iterate over the elements of the array and print each element. In the main function, an array of integers is declared and initialized with values. The print function is called with this array as an argument. Since the array has 8 elements, the for loop in the print function will iterate 8 times and print each element of the array. Therefore, the output of the program will be 1, 2, 3, 4, 5, 6, 7, 8.

    Rate this question:

  • 3. 

    Predict the output of below program:#include  int main(){    int arr[5];    // Assume base address of arr is 2000 and size of integer is 32 bit    printf("%u %u", arr + 1, &arr + 1);     return 0;}

    • A.

      2004 2020

    • B.

      2004 2004

    • C.

      2004 Garbage value

    • D.

      The program fails to compile because Address-of operator cannot be used with array name

    Correct Answer
    A. 2004 2020
    Explanation
    The program prints the memory addresses of two different elements in the array. The expression "arr + 1" gives the address of the second element in the array, which is 2004. The expression "&arr + 1" gives the address of the next memory block after the entire array, which is 2020.

    Rate this question:

  • 4. 

    Consider the following declaration of a ‘two-dimensional array in C:char a[100][100]; Assuming that the main memory is byte-addressable and that the array is stored starting from memory address 0, the address of a[40][50] is

    • A.

      4040

    • B.

      4050

    • C.

      5040

    • D.

      5050

    Correct Answer
    B. 4050
    Explanation
    The given declaration of a two-dimensional array in C, char a[100][100], indicates that the array has 100 rows and 100 columns. Since the array is stored starting from memory address 0, to find the address of a[40][50], we need to calculate the offset based on the size of each element. In this case, each element is a char, which typically takes 1 byte of memory. Therefore, the offset for 40 rows would be 40 * 100 * 1 = 4000 bytes, and the offset for 50 columns would be 50 * 1 = 50 bytes. Adding these offsets to the base address 0 gives us the address of a[40][50] as 4050.

    Rate this question:

  • 5. 

    Output of following program?#include <stdio.h>int main(){    int i = 5;    printf("%d %d %d", i++, i++, i++);    return 0;}

    • A.

      7 6 5

    • B.

      5 6 7

    • C.

      7 7 7

    • D.

      Compiler Dependent

    Correct Answer
    D. Compiler Dependent
  • 6. 

    Consider the following C functionvoid swap (int a, int b){   int temp;   temp = a;   a = b;   b = temp;}

    • A.

      Call swap(x,y)

    • B.

      Call swap(&x,&y)

    • C.

      Swap(x,y) cannot be used as it does not return any value

    • D.

      Swap(x,y) cannot be used as the parameters are passed by value

    Correct Answer
    D. Swap(x,y) cannot be used as the parameters are passed by value
    Explanation
    The explanation for the given correct answer is that the function swap(x,y) cannot be used because the parameters are passed by value. In C, when a function is called, the values of the arguments are copied into the function parameters. Therefore, any changes made to the parameters inside the function will not affect the original variables that were passed as arguments. In order to modify the original variables, the function should be called using their addresses, as shown in the second option (swap(&x,&y)).

    Rate this question:

  • 7. 

    Which is the quickest sorting technique out of the following?(Random dataset)

    • A.

      Merge Sort

    • B.

      Bubble Sort

    • C.

      Insertion Sort

    • D.

      Bucket Sort

    Correct Answer
    A. Merge Sort
    Explanation
    Merge Sort is the quickest sorting technique out of the given options for a random dataset. Merge Sort has a time complexity of O(n log n), which means it can efficiently sort large datasets. It uses a divide and conquer approach, dividing the dataset into smaller subproblems and then merging them back together in a sorted manner. In comparison, Bubble Sort and Insertion Sort have a time complexity of O(n^2), making them slower for large datasets. Bucket Sort, although efficient for certain datasets, may not be the quickest for a random dataset as it depends on the distribution of the data.

    Rate this question:

  • 8. 

    Correct Answer
    19
  • 9. 

    Replace the ? by the correct Mathematics symbol to make the expression true18 ? 12 ? 4 ? 5 = 59Write your answer in the space for the whole expressioneg: 18+12+4+5=59 

    Correct Answer
    18 x 12 / 4 + 5 = 59
  • 10. 

    If a doctor gives you 3 pills and tells you to take one pill every half hour, how long would it take before all the pills had been taken? How many hours?

    Correct Answer
    1
    Explanation
    The question states that a doctor gives you 3 pills and tells you to take one pill every half hour. Since there are 3 pills and you take one pill every half hour, it would take a total of 1 hour to take all the pills.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • May 16, 2016
    Quiz Created by
    Samarthmishra95
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.