Computer Programming Language Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Samarthmishra95
S
Samarthmishra95
Community Contributor
Quizzes Created: 1 | Total Attempts: 556
| Attempts: 556 | Questions: 9
Please wait...
Question 1 / 9
0 %
0/100
Score 0/100
1.

Explanation

not-available-via-ai

Submit
Please wait...
About This Quiz
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... see moreabout 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 see less

2. 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

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.

Submit
3. 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?

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.

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

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.

Submit
5. 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;}

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.

Submit
6. 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;}

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.

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

Explanation

not-available-via-ai

Submit
8. Consider the following C function
void swap (int a, int b){   int temp;   temp = a;   a = b;   b = temp;}

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)).

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

Explanation

not-available-via-ai

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

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
Cancel
  • All
    All (9)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Consider the following declaration of a 'two-dimensional array in...
If a doctor gives you 3 pills and tells you to take one pill every...
Which is the quickest sorting technique out of the following?(Random...
Predict the output of below program:#include  int...
What is output?# include <stdio.h> void print(int...
Output of following program?#include <stdio.h>int...
Consider the following C functionvoid swap (int a, int...
Replace the ? by the correct Mathematics symbol to make the expression...
Alert!

Advertisement