TCS Previous Year Papers and Study materials
Q.A pointer variable can be
1. Changed within function.
2. Assigned an integer value.
3. None of these
4. Passed to a function as argument.
Correct Op: 4
Q. Which of the following uses structure?
1. Linked Lists
2. Array of structures
3. All of these
4. Binary Tree
Correct Op: 3
Q. Strings are character arrays. The last index of it contains the null-terminated character
1. \t
2. \1
3. \0
4. \n
Correct Op: 3
Q. Which of the following is a collection of different data types?
1. String
2. Structure
3. Array
4. Files
Correct Op: 2
Q. What function should be used to free the memory allocated by calloc() ?
1. free();
2. malloc(variable_name, 0)
3. dealloc();
4. memalloc(variable_name, 0)
Correct Op: 1
Q. In the standard library of C programming language, which of the following
header file is designed for basic mathematical operations?
1. conio.h
2. stdio.h
3. math.h
4. Dos.h
Correct Op: 3
Q. int **ptr; is?
1. Pointer to integer
2. None of these
3. Pointer to pointer
4. Invalid declaration
Correct Op: 3
Q8. Which of the following special symbol allowed in a variable name?
1. (underscore)
2. – (hyphen)
3. | (pipeline)
4. * (asterisk)
Correct Op: 1
Q9. All keywords in C are in
1. Uppercase letters
2. None of these
3. Lowercase letters
4. Camel Case letters
Correct Op: 3
Q10. What should the program below print?
C
C
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void myfunc(char** param){
++param;
}
int main(){
char* string = (char*)malloc(64);
strcpy(string, “hello_World”);
myfunc(&string);
myfunc(&string);
printf(“%s\n”, string);
// ignore memory leak for sake of quiz
return 0;
}
1. hello_World
2. ello_World
3. lo_World
4. llo_World
Correct Op: 1
Q: What is the output of this C code?
C
C
#include
#include
#include
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
printf(“%d%d%d\n”, k, *p, **p);
} quiz
return 0;
}