Programming :: All Aptitude Test ::

Hassan
1.Which of the following statements correctly declare a function that receives a pointer to pointer to a pointer to a float and returns a pointer to a pointer to a pointer to a pointer to a float?
A. float **fun(float***);
B. float *fun(float**);
C. float fun(float***);
D. float **fun(float***);

2.Which of the statements is correct about the program?
A. j and i are pointers to an int
B. i is a pointer to an int and stores address of j
C. j is a pointer to an int and stores address of i
D. j and i are pointers to an int

3.Which of the statements is correct about the program?
A. It prints ASCII value of the binary number present in the first byte of a float variable a.
B. It prints character equivalent of the binary number present in the first byte of a float variable a.
C. It will print 3
D. It prints ASCII value of the binary number present in the first byte of a float variable a.

4.In the following program add a statement in the function fun() such that address of a gets stored in j?
A. **k=a;
B. k=&a;
C. *k=&a
D. **k=a;

5.Which of the following statements correct about k used in the below statement?
A. k is a pointer to a pointer to a pointer to a char
B. k is a pointer to a pointer to a pointer to a pointer to a char
C. k is a pointer to a char pointer
D. k is a pointer to a pointer to a pointer to a char

6.Which of the statements is correct about the program?
A. Output: Garbage value
B. Output: 1
C. Output: 3
D. Output: Garbage value

7.Which statement will you add to the following program to ensure that the program outputs "PakMcqs" on execution?
A. *pt='';
B. pt='\0';
C. pt='\n';
D. *pt='';

8.In the following program add a statement in the function fact() such that the factorial gets stored in j?
A. j=s;
B. *j=s;
C. *j=&s;
D. j=s;

9.What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
A. The element will be set to 0.
B. The compiler would report an error.
C. The program may crash if some important data gets overwritten.
D. The element will be set to 0.

10.What does the following declaration mean?
A. ptr is array of pointers to 10 integers
B. ptr is a pointer to an array of 10 integers
C. ptr is an array of 10 integers
D. ptr is array of pointers to 10 integers

11.In C, if you pass an array as an argument to a function, what actually gets passed?
A. Value of elements in array
B. First element of the array
C. Base address of the array
D. Value of elements in array

12.What will be the output of the program?
A. 2, 1, 15
B. 1, 2, 5
C. 3, 2, 15
D. 2, 1, 15

13.What will be the output of the program?
A. 2, 3, 4, 5
B. 1, 2, 3, 4
C. 0, 1, 2, 3
D. 2, 3, 4, 5

14.What will be the output of the program?
A. 1
B. 2
C. 3
D. 1

15.What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes?
A. 65474, 65476
B. 65480, 65496
C. 65480, 65488
D. 65474, 65476

16.What will be the output of the program in Turbo C (under DOS)?
A. 1, 2, 3, 4, 5,
B. Garbage value, 1, 2, 3, 4
C. 0, 1, 2, 3, 4,
D. 1, 2, 3, 4, 5,

17.What will be the output of the program?
A. 1
B. 10
C. 0
D. 1

18.What will be the output of the program if the array begins at address 65486?
A. 65486, 65488
B. 65486, 65486
C. 65486, 65490
D. 65486, 65488

19.What will be the output of the program?
A. 5
B. 4
C. 6
D. 5

20.What will be the output of the program if the array begins 1200 in memory?
A. 1200, 1202, 1204
B. 1200, 1200, 1200
C. 1200, 1204, 1208
D. 1200, 1202, 1204

21.Which of the following statements mentioning the name of the array begins DOES NOT yield the base address?
A. 1
B. 1 , 2
C. 2
D. 1

22.Which of the following statements are correct about an array?
A. 1
B. 1 , 4
C. 2 , 3
D. 1

23.Which of the following function sets first n characters of a string to a given character?
A. strinit()
B. strnset()
C. strset()
D. strinit()

24.If the two strings are identical, then strcmp() function returns.
A. -1
B. 1
C. 0
D. -1

25.How will you print \n on the screen?
A. printf("\n");
B. echo "\\n";
C. printf('\n');
D. printf("\n");

26.The library function used to find the last occurrence of a character in a string is?
A. strnstr()
B. laststr()
C. strrchr()
D. strnstr()

27.Which of the following function is used to find the first occurrence of a given string in another string?
A. strchr()
B. strrchr()
C. strstr()
D. strchr()

28.Which of the following function is more appropriate for reading in a multi-word string?
A. printf();
B. scanf();
C. gets();
D. printf();

29.What will be the output of the program ?
A. Hello
B. World
C. Hello World
D. Hello

30.What will be the output of the program?
A. A
B. a
C. c
D. A


Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers