# Computer Programming Language Quiz

Approved & Edited by ProProfs Editorial Team
At ProProfs Quizzes, our dedicated in-house team of experts takes pride in their work. With a sharp eye for detail, they meticulously review each quiz. This ensures that every quiz, taken by over 100 million users, meets our standards of accuracy, clarity, and engagement.
| Written by Samarthmishra95
S
Samarthmishra95
Community Contributor
Quizzes Created: 1 | Total Attempts: 520
Questions: 10 | Attempts: 520  Settings  . 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

• 1.

• 2.

### What is output?# include <stdio.h> void print(int arr[]){   int n = sizeof(arr)/sizeof(arr);   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

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;    // 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

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; Assuming that the main memory is byte-addressable and that the array is stored starting from memory address 0, the address of a is

• A.

4040

• B.

4050

• C.

5040

• D.

5050

B. 4050
Explanation
The given declaration of a two-dimensional array in C, char a, 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, 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 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

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

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

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

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? Back to top