Académique Documents
Professionnel Documents
Culture Documents
Question: 1
Can we declare
function inside
t t f C
(A) Yes
(B) No
(C) Depends on Compiler
(D) Yes but run time error
Show Ans
Compiler Forum
Expert structure[Posted by: Admin | Chicago, USA]
Question: 2
What is storage
class for variable A
in below code?
void main()
{
int A;
A = 10;
printf("%d", A);
}
(A) extern
(B) auto
(C) register
(D) static
Show Ans
Compiler Forum
Expert storgeclass[Posted by: Admin | Chicago, USA]
Question: 3
void main()
{
for(; ;)
for(; ;)
printf("Hello..");
}
Show Ans
Compiler Forum
Expert loops[Posted by: Admin | Chicago, USA]
Question: 4
What is output of
below program?
void main()
{
for(; ;);
for(; ;);
printf("Hello");
Show Ans
Compiler Forum
Expert loops[Posted by: Admin | Chicago, USA]
Question: 5
for(i = 0,i<5,i++)
{
printf("Hello");
}
}
Show Ans
Compiler Forum
Expert loops[Posted by: Admin | Chicago, USA]
Learn more
Question: 6
What is output of
below program?
void main()
{
int i;
for(i=0; i<5;
++i++)
{
printf("Hello");
}
}
(A) Hello is printed 5 times
(B) Compilation Error
(C) Hello is printed 2 times
(D) Hello is printed 3 times
Show Ans
Compiler Forum
Expert loops[Posted by: Admin | Chicago, USA]
Question: 7
What is output of
below program?
void main()
{
int i,j;
for(i =
0,j=0;i<5;i++)
{
printf("%d%d--
",i,j);
}
(A) 0--01--12--23--34--
(B) 00--10--20--30--40--
(C) Compilation Error
(D) 00--01--02--03--04--
Show Ans
Compiler Forum
Expert loops[Posted by: Admin | Chicago, USA]
Question: 8
printf("CppBuzz.com"
)
(A) 0 times
(B) Infinite times (Untill Stack is overflow)
(C) 1 time
(D) Nothing is printed
Show Ans
Compiler Forum
Expert loops[Posted by: Admin | Chicago, USA]
Question: 9
(A) 5 times
(B) 4 times
(C) 2 times
(D) 1 time
Show Ans
Compiler Forum
Expert loops[Posted by: Admin | Chicago, USA]
Question: 10
int main()
{
int x;
x=10,20,30;
printf("%d",x);
return 0;
}
(A) 10
(B) 20
(C) 30
(D) Compilation Error
Show Ans
Compiler Forum
Expert operators[Posted by: Admin | Chicago, USA]
Question: 11
int main()
{
int a = 5;
int b = 10;
int c = a+b;
printf("%i",c);
}
(A) 0
(B) 15
(C) Undefined i
(D) Any other Compiler Error
Show Ans
Compiler Forum
EXpert datatype[Posted by: Admin | Chicago, USA]
Question: 12
int main()
{
int _ = 10;
int __ = 20;
int ___ = _
+ __;
printf("__%d",___);
return 0;
}
(A) Compilation Error
(B) Runtime Error
(C) __0
(D) __30
Show Ans
Compiler Forum
Expert datatype[Posted by: Admin | Chicago, USA]
Question: 13
int x = 10;
int main()
{
int x = 0;
printf("%d",x);
return 0;
}
(A) 10
(B) 0
(C) Compilation Error
(D) Undefined
Show Ans
Compiler Forum
Expert datatype[Posted by: Admin | Chicago, USA]
Question: 14
What is sizeof() in
C?
(A) Operator
(B) Function
(C) Macro
(D) None of these
Show Ans
Compiler Forum
Expert operators[Posted by: Admin | Chicago, USA]
Question: 15
Is it possible to
write C program
hi h it i t lf?
(A) Yes
(B) No
Show Ans
Compiler Forum
Expert filehandling[Posted by: Admin | Chicago, USA]
Question: 16
int main()
{
if(printf("cppbuzz.c
om"))
printf("cppbuzz.com"
);
(A) 1
(B) 2
(C) 0
(D) Compilation Error
Show Ans
Compiler Forum
Expert conditional[Posted by: Admin | Chicago, USA]
Question: 17
#include <stdio.h>
#include <stdlib.h>
i tf("% "
(A) 1234
(B) 12340
(C) 123
(D) 0
Show Ans
Compiler Forum
Expert function[Posted by: Admin | Chicago, USA]
Question: 18
#include <stdio.h>
#include <stdlib.h>
(A) 0
(B) 23.5
(C) 23.450000
(D) 23.4
Show Ans
Compiler Forum
Expert function[Posted by: Admin | Chicago, USA]
Question: 19
#include <stdio.h>
char str1 [] =
"CppBuzz" ;
int a = 10;
char str2[12] ;
sprintf (str2, "%s-
%d", str1, a) ;
printf ( "%s", str2
) ;
t 0
(A) CppBuzz10
(B) CppBuzz-10
(C) CppBuzz 10
(D) Compilation Error
Show Ans
Compiler Forum
Expert function[Posted by: Admin | Chicago, USA]
Question: 20
#include <stdio.h>
char * f();
char a = 'a';
char *f()
{
return &a;
}
(A) a
(B) %a
(C) %%
(D) %
Show Ans
Compiler Forum
Expert function[Posted by: Admin | Chicago, USA]
Question: 21
Which compilation
unit is responsible
f ddi h d
(A) Linker
(B) Compiler
(C) Assembler
(D) Preprocessor
Show Ans
Compiler Forum
Expert preprocessor[Posted by: Admin | Chicago, USA]
Question: 22
What is the
extension of output
fil d d b
(A) .h
(B) .exe
(C) .i
(D) .asm
Show Ans
Compiler Forum
Expert preprocessor[Posted by: Admin | Chicago, USA]
Question: 23
__FILE__ is
predefined macro and
t i th t
(A) Yes
(B) No
Show Ans
Compiler Forum
Expert preprocessor[Posted by: Admin | Chicago, USA]
Question: 24
Which of the
following ways are
correct to include
h d fil i C
(A) #include<stdio.h>
(B) #include"stdio.h"
(C) Both A & B
Show Ans
Compiler Forum
Expert datatype[Posted by: Admin | Chicago, USA]
Question: 25
(A) #pragma
(B) #error
(C) #ifndef
(D) #elseif
Show Ans
Compiler Forum
Expert macros[Posted by: Admin | Chicago, USA]
Question: 26
(A) -asm
(B) -S
(C) -o
(D) -c
Show Ans
Compiler Forum
Expert gcc[Posted by: Admin | Chicago, USA]
Question: 27
(A) __asm__
(B) _asm_
(C) __asm
(D) asm
Show Ans
Compiler Forum
Expert gcc[Posted by: Admin | Chicago, USA]
Question: 28
(A) __asm__
(B) _asm_
(C) __asm
(D) asm
Show Ans
Compiler Forum
Expert gcc[Posted by: Admin | Chicago, USA]
Question: 29
Which command is to
compile C code
ith t li ki
Show Ans
Compiler Forum
Expert gcc[Posted by: Admin | Chicago, USA]
Question: 30
(A) gcc -g
(B) gcc -a
(C) gcc -e
(D) gcc -b
Show Ans
Compiler Forum
Expert gcc[Posted by: Admin | Chicago, USA]
Applied Digital Skills
Learn more
Question: 31
Show Ans
Compiler Forum
Expert gcc[Posted by: Admin | Chicago, USA]
Question: 32
(A) gcc -W
(B) gcc -w
(C) gcc -Wall
(D) gcc - wall
Show Ans
Compiler Forum
Expert gcc[Posted by: Admin | Chicago, USA]
Question: 33
//Program is
compiled on Dev-C++
(32 bit) compiler
#include<stdio.h>
#include<string.h>
int main()
{
char arr[] =
"CppBuzz.com";
printf("%d-
%d" [0]
(A) D-Q
(B) D-A
(C) 67-112
(D) 68-113
Show Ans
Compiler Forum
Expert arrays[Posted by: Admin | Chicago, USA]
Question: 34
int main()
{
FILE *fp;
char c[1024];
fp =
fopen("test.txt",
"r"); // "Kernighan
and Ritchie"
c[0] = getc(fp);
fseek(fp, 0,
SEEK_END);
f k(f 7L
(A) Kernig
(B) ernigh
(C) Kernigh
(D) Ritch
Show Ans
Compiler Forum
Expert filehandling[Posted by: Admin | Chicago, USA]
Question: 35
Which of the
following Linux
d i d t
Show Ans
Compiler Forum
Expert compilation[Posted by: Admin | Chicago, USA]
Learn more
Question: 36
#include <iostream>
using namespace std;
int main ()
{
int x, y;
x = 2;
y = ++x *
++x;
cout << x <<
y;
x = 2;
y = x++ *
++x;
cout << x <<
y;
t 0
(A) 412412
(B) 41649
(C) 49416
(D) 41649
Show Ans
Compiler Forum
Expert operators[Posted by: Admin | Chicago, USA]
Question: 37
What is important
difference between
t t & i ?
Show Ans
Compiler Forum
Expert structure[Posted by: Admin | Chicago, USA]
Question: 38
(A) Yes
(B) No
Show Ans
Compiler Forum
Expert structure[Posted by: Admin | Chicago, USA]
Question: 39
Which predefined
function is used to
it h l
(A) write()
(B) fwrite()
(C) swrite()
(D) None of the above
Show Ans
Compiler Forum
Expert structure[Posted by: Admin | Chicago, USA]
Question: 40
Show Ans
Compiler Forum
Expert operators[Posted by: Admin | Chicago, USA]
Great Savings on
Supplements
Question: 41
Show Ans
Compiler Forum
Expert assembler[Posted by: Admin | Chicago, USA]
Question: 42
Show Ans
Compiler Forum
Expert compilation[Posted by: Admin | Chicago, USA]
Question: 43
#include <stdio.h>
int main()
{
int a=5, b=2;
printf("%d",
a+++b);
Show Ans
Compiler Forum
Expert operators[Posted by: Admin | Chicago, USA]
Question: 44
int main()
{
int a = 1;
short int b = 2;
float c = 3;
if(sizeof((a == 2)
? c : b) ==
sizeof(float))
{
printf("float");
}
else
if(sizeof((a == 2) ?
c : b) ==
sizeof(short int))
{
(A) float
(B) short int
(C) nothing
(D) compilation error
Show Ans
Compiler Forum
Expert operators[Posted by: Varun Kumar Reddy | Bangalore]
Question: 45
#include<stdio.h>
int main(void)
{
char str1[] =
"Hello. How are
you?";
char str2[21];
int pos;
for(pos=0;
pos<21; pos++);
{
str2[pos] =
str1[pos];
}
printf("str1: %s,
t 2 % " t 1
(A) str1: Hello. How are you?, str2: Hello. How are you?
(B) str1: Hello. How are you?, str2: Hello. How are you?nullnull
(C) str1: Hello. How are you?, str2: Hello. How are you?garbagevalue
(D) str1: Hello. How are you?, str2: garbagevalue
Show Ans
Compiler Forum
Expert arrays[Posted by: Admin | Chicago, USA]
Great Savings on
Supplements
Question: 46
#include<stdio.h>
int main()
{
int a = 0,
b=1,c=2,d;
printf("%d %d %d
%d", a,b,c,d);
t 0
(A) 2 2 3 1
(B) 2 2 3 0
(C) 3 2 3 0
(D) 1 1 2 1
Show Ans
Compiler Forum
Expert operators[Posted by: Admin | Chicago, USA]
Question: 47
Find output of below
C program
#include <stdio.h>
int main()
{
char *_ptr;
*_ptr =
malloc(10);
*_ptr = 999;
printf("%d",*_ptr);
t 0
(A) 999
(B) 10
(C) 0
(D) Segmentation fault
Show Ans
Compiler Forum
Expert malloc_free[Posted by: Admin | Chicago, USA]
Question: 48
#include <stdio.h>
int main()
{
char *_ptr =
malloc(100);
strcpy(_ptr,
"cppbuzz");
memset(_ptr,
NULL, sizeof(_ptr));
if(*_ptr == NULL)
printf("NULL");
else
printf("%s",_ptr);
t 0
(A) NULL
(B) cppbuzz
(C) Nothing is printed
(D) Typecasting Error
Show Ans
Compiler Forum
Expert malloc_free[Posted by: Admin | Chicago, USA]
Question: 49
#include <stdio.h>
int main()
{
char *_ptr =
malloc(100);
if(_ptr!=NULL)
free(_ptr);
free(_ptr);
return 0;
}
Show Ans
Compiler Forum
Expert malloc_free[Posted by: Admin | Chicago, USA]
Question: 50
#include <stdio.h>
int main()
{
char * _ptr =
NULL;
_ptr = malloc(0);
if(_ptr==NULL)
printf("_ptr is
NULL");
else printf("
_ptr not NULL ");
printf(" %p ",
_ptr);
*_ptr = '@';
i tf(" % "
Show Ans
Compiler Forum
Expert malloc_free[Posted by: Admin | Chicago, USA]
Track
like
it’s
2019.
LEARN MORE
Question: 51
#include <stdio.h>
typedef enum{
Male, Female
}SEX;
void main()
{
SEX var = Male;
SEX var1 = Female;
printf("%s
%s",var, var1);
}
Show Ans
Compiler Forum
Expert enum[Posted by: Admin | Chicago, USA]
Question: 52
#include <stdio.h>
typedef enum{
Male, Female=-1
}SEX;
void main()
{
SEX var = Male;
SEX var1 = Female;
printf("%d
%d",var, var1);
}
Show Ans
Compiler Forum
Expert enum[Posted by: Admin | Chicago, USA]
Loops Conditional Functions Operators Structure Enum FileHandling Data Types Inheritance Pointers
Classes & Objects Vtable Type Casting New & Delete Namespaces Reference Variables Virtual Functions
Abstract Class STL Singleton Class Exceptions C++ 11 C++ 14 C++ 17 gcc/g++ others
Switch to C Questions