Skip to content

Category Archives: C Quiz

Q1. Is the output of this code True or False? #include <stdio.h> int main(void) {     int b = 20;     int* y = &b;     char n… Read More
The localtime() function is defined in the time.h header file. The localtime( ) function return the local time of the user i.e time present at… Read More
What will be the output of the following C code? #include <stdio.h> int main() { int i; for ( i=0; i<5; i++ ) {    int… Read More
Prerequisite : Pointers in C Question 1 : What will be the output of following program? #include "stdio.h" int main() {     char a[] = {… Read More
What is the output for the following code snippet? #include<stdio.h> #define A -B #define B -C #define C 5    int main() {   printf("The value… Read More
Output of following program under the assumption that numbers are stored in 2’s complement form. #include<stdio.h> int main() {    printf("%c\n", ~('C' * -1));    return 0;… Read More
C is a mid-level language and it needs a compiler to convert it into an executable code so that the program can be run on… Read More
Pick the best statement for the below program: #include "stdio.h"    int main() {  union {int i1; int i2;} myVar = {.i2 =100};  printf("%d %d",myVar.i1,… Read More
Pick the best statement for the below program: #include "stdio.h"    int main() {  struct {int i; char c;} myVar = {.c ='A',.i = 100};… Read More
Pick the best statement for the below program: #include "stdio.h"    int main() {  struct {int a[2], b;} arr[] = {[0].a = {1}, [1].a =… Read More
Pick the best statement for the below program snippet: struct {int a[2];} arr[] = {1,2}; (A) No compile error and it’ll create array arr of… Read More
Pick the best statement for the below program: #include "stdio.h"    int main() {  struct {int a[2];} arr[] = {{1},{2}};     printf("%d %d %d %d",arr[0].a[0],arr[0].a[1],arr[1].a[0],arr[1].a[1]);… Read More
Pick the best statement for the below program: #include "stdio.h"    int size = 4; int arr[size];    int main() {  if(arr[0])   printf("Initialized to ZERO");… Read More
Pick the best statement for the below program: #include "stdio.h"     void fun(int n) {    int idx;    int arr1[n] = {0};    int arr2[n];        for… Read More
Pick the best statement for the below: int arr[50] = {0,1,2,[47]=47,48,49}; (A) This isn’t allowed in C and it’ll give compile error (B) This is… Read More