C programming
Test your knowledge of C programming fundamentals including pointers, operators, loops, data types, and standard library functions through code output questions.
Questions
Wild pointer in 'C' ____________.
- is initialized by constant
- is not initialized.
- does not exist in C language
- only takes 'int' values
- works like null pointer
Find the output of the following expression.
#include<stdio.h>
#include<conio.h>
void main()
{
int x, y =3;
x= ++y + 7;
printf(" %d " , x)
}
- 10
- 11
- 8
- 12
- None of the above
FInd the output of the following expression.
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=1;i<5;i++)
printf(" %d ",i);
}
- 1 2 3 4 5
- 1 2 3 4
- 1 2 3 4 5 6
- 0 1 2 3 4 5
- None of the above
Find the value of C.
C = (a>0 && a<1)? a : b given a =10 , b = 20
- 10
- 20
- C will take garbage value
- 0 or 1
- None of these
Find the output of the following expression.
#include<stdio.h>
#iinclude<conio.h>
void main()
{
int x=5 , y;
y = ++x;
printf(%d , y);
}
- 6
- 5
- 7
- Wrong expression
- None of these
In how many categories can the data types of C be classified?
- 5
- 4
- 3
- 2
- None of the above
Which of the following given standard functions accepts two arguments while calling?
- strspn();
- strnset();
- strnsetu();
- strdup();
- strncpyk();
How many valid categories of character sets are there in C language?
- 5
- 4
- 3
- 2
- None of these
Find out the output of the following program or error (if any).
#include<stdio.h>
#include<conio.h>
int main()
{
const int num=12;
++num;
printf("num=%d",num);
getch();
}
- Num=12
- Num=13
- Garbage value
- Error in the program
- Blank screen (no output)
Which of the following arithmetic operations is/are not possible in C language?
- Addition of two addresses
- Multiplication of two addresses
- Multiplication of an address with a constant
- Divison of an address with a constant
- All of the above
Find out the output of the given program or error (if any).
#include<stdio.h>
#include<conio.h>
int main()
{
unsigned u=65535;
printf("u=%d",u);
getch();
}
- u=1
- u=2
- u=65535
- error in the program
- None of these
Which of the following is/are the standard header files in ANSII C?
- <assert.h>
- <complex.h>
- <limits.h>
- Both 1 and 3
- All 1, 2 and 3
What is the ASCII value of ESC character?
#include<stdio.h>
#include<conio.h>
using namespace std;
class first
{
int b;
public:
first()
{
b=10;
}
void display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