Skip to content

Category Archives: C Quiz

Does C perform array out of bound checking? What is the output of the following program? int main() {     int i;     int arr[5] = {0};… Read More
Predict output of following program int main() {     int i;     int arr[5] = {1};     for (i = 0; i < 5; i++)         printf("%d ", arr[i]);… Read More
What does the following C statement mean? scanf("%4s", str); (A) Read exactly 4 characters from console. (B) Read maximum 4 characters from console. (C) Read… Read More
Output of following program #include <stdio.h> int fun(char *p) {     if (p == NULL || *p == '\0') return 0;     int current = 1, i… Read More
#include <stdio.h>    char *c[] = {"GeksQuiz", "MCQ", "TEST", "QUIZ"}; char **cp[] = {c+3, c+2, c+1, c}; char ***cpp = cp;    int main() {… Read More
What does the following statement do? x  = x | 1 << n; (A) Sets x as 2n (B) Sets (n+1)th bit of x (C)… Read More
#include <stdio.h> int main() {     int a[5] = {1,2,3,4,5};     int *ptr = (int*)(&a+1);     printf("%d %d", *(a+1), *(ptr-1));     return 0; } (A) 2 5 (B) Garbage… Read More
# include <iostream> # include <string.h> using namespace std;    struct Test {   char str[20]; };    int main() {   struct Test st1, st2;   strcpy(st1.str,… Read More
Predict the output of following program #include<stdio.h> int main() {     int a = 12;     void *ptr = (int *)&a;     printf("%d", *ptr);     getchar();     return 0; }… Read More
What is the use of “#pragma once”? (A) Used in a header file to avoid its inclusion more than once. (B) Used to avoid multiple… Read More
Which of the following is true? (A) “ptr = calloc(m, n)” is equivalent to following ptr = malloc(m * n); (B) “ptr = calloc(m, n)”… Read More
Predict the output of following C program #include <stdio.h> int main() {     char a = 012;        printf("%d", a);        return 0; } (A) Compiler… Read More
What is the return type of malloc() or calloc() (A) void * (B) Pointer of allocated memory type (C) void ** (D) int * Answer:… Read More
union test {     int x;     char arr[4];     int y; };    int main() {     union test t;     t.x = 0;     t.arr[1] = 'G';     printf("%s", t.arr);… Read More
union test {     int x;     char arr[8];     int y; };    int main() {     printf("%d", sizeof(union test));     return 0; } Predict the output of above… Read More

Start Your Coding Journey Now!