NEW
Font size
WorksheetsSharda fest 2024
Total questions: 25
Worksheet time: 50mins
1) What is the 16-bit compiler allowable range for integer constants?
3.4e38 to 3.4e38
.-32767 to 32768
-32668 to 32667
-32768 to 32767
2) Study the following program:
main()
{printf("javatpoint");
main();}
What will be the output of this program?
Wrong statement
It will keep on printing javatpoint
It will Print javatpoint once
None of the these
3) What is required in each C program?
The program must have at least one function.
The program does not require any function.
Input data
Output data
4) What will this program print?
main()
{
int i = 2;
{
int i = 4, j = 5;
printf("%d %d", i, j);
}
printf("%d %d", i, j);
}
4525
2525
4545
None of the these
5) Which of the following comment is correct when a macro definition includes arguments?
The opening parenthesis should immediately follow the macro name.
There should be at least one blank between the macro name and the opening parenthesis.
There should be only one blank between the macro name and the opening parenthesis.
All the above comments are correct.
6) What is a lint?
C compiler
Interactive debugger
Analyzing tool
C interpreter
7) What is the output of this statement "printf("%d", (a++))"?
The value of (a + 1)
The current value of a
Error message
Garbage
8) Study the following program:
main()
{
char x [10], *ptr = x;
scanf ("%s", x);
change(&x[4]);
}
change(char a[])
{
puts(a);
}
If abcdefg is the input, the output will be
abcd
abc
efg
Garbage
9) Study the following program:
main()
{
int a = 1, b = 2, c = 3:
printf("%d", a + = (a + = 3, 5, a))
}
What will be the output of this program?
6
9
12
8
10) What does this declaration mean?
int x : 4;
X is a four-digit integer.
X cannot be greater than a four-digit integer.
X is a four-bit integer.
None of the these
11) Why is a macro used in place of a function?
It reduces execution time.
It reduces code size.
It increases execution time.
It increases code size.
12) In the C language, the constant is defined _______.
Before main
After main
Anywhere, but starting on a new line.
None of the these.
13) How many times will the following loop execute?
for(j = 1; j <= 10; j = j-1)
Forever
Never
0
1
14) A pointer is a memory address. Suppose the pointer variable has p address 1000, and that p is declared to have type int*, and an int is 4 bytes long. What address is represented by expression p + 2?
1002
1004
1006
1008
15) What is the result after execution of the following code if a is 10, b is 5, and c is 10?
If ((a > b) && (a <= c))
a = a + 1;
else
c = c+1;
a = 10, c = 10
a = 11, c = 10
a = 10, c = 11
a = 11, c = 11
16) Which one of the following is a loop construct that will always be executed once?
for
while
switch
do while
17) Which of the following best describes the ordering of destructor calls for stack-resident objects in a routine?
The first object created is the first object destroyed; last created is last destroyed.
The first object destroyed is the last object destroyed; last created is first destroyed.
Objects are destroyed in the order they appear in memory, the object with the lowest memory address is destroyed first.
The order is undefined and may vary from compiler to compiler.
18) How many characters can a string hold when declared as follows?
char name[20]:
18
19
20
None of the these
19) Directives are translated by the
Pre-processor
Compiler
Linker
Editor
20) How many bytes does "int = D" use?
0
1
2 or 4
10
21) What feature makes C++ so powerful?
Easy implementation
Reusing the old code
Easy memory management
All of the above
22) Which of the following will copy the null-terminated string that is in array src into array dest?
dest = src;
dest == src;
strcpy(dest, src);
strcpy(src, dest);
23) In the statement "COUT << "javatpoint" << end1;", end1 is a ___.
Extractor
Inserter
Manipulator
Terminator
24) Each instance of a class has a different set of
Class interfaces
Methods
Return types
Attribute values
25) How many instances of a class can be declared?
1
10
As per required
None of the these
