Programming :: All Aptitude Test ::

Hassan
1.What will be the output of the program?
A. 3, 4, 4, 3
B. 4, 3, 4, 3
C. 3, 3, 4, 4
D. 3, 4, 4, 3

2.Point out the error in the program?
A. Missing parenthesis in return statement
B. The function should be defined as int f(int a, int b)
C. Redeclaration of a
D. Missing parenthesis in return statement

3.Point out the error in the program?
A. Error: Prototype declaration
B. No error
C. Error: return statement cannot be used with conditional operators
D. Error: Prototype declaration

4.Point out the error in the program?
A. Error: Not allowed assignment
B. Error: Doesn't print anything
C. No error
D. Error: Not allowed assignment

5.Which of the following statements are correct about the program?
A. It prints garbage values infinitely
B. Runs infinitely without printing anything
C. Error: main() cannot be called inside printf()
D. It prints garbage values infinitely

6.There is a error in the below program. Which statement will you add to remove it?
A. Add prototype: float f(aa, bb)
B. Add prototype: float f(int, float)
C. Add prototype: float f(float, int)
D. Add prototype: float f(aa, bb)

7.Which of the following statements are correct about the function?
A. The function calculates the value of 1 raised to power num
B. The function calculates the square root of an integer
C. The function calculates the factorial value of an integer
D. The function calculates the value of 1 raised to power num

8.What are the different types of real data type in C ?
A. float, double
B. short int, double, long int
C. float, double, long double
D. float, double

9.What will you do to treat the constant 3.14 as a long double?
A. use 3.14LF
B. use 3.14DL
C. use 3.14L
D. use 3.14LF

10.Which statement will you add in the following program to work it correctly?
A. # include < conio.h >
B. # include < math.h >
C. # include< stdlib.h >
D. # include < conio.h >

11.We want to round off x, a float, to an int value, The correct way to do is?
A. y = (int)(x + 0.5)
B. y = int(x + 0.5)
C. y = (int)x + 0.5
D. y = (int)(x + 0.5)

12.The binary equivalent of 5.375 is?
A. 101.101110111
B. 101.011
C. 101011
D. 101.101110111

13.A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored?
A. ABCD
B. DCBA
C. 0xABCD
D. ABCD

14.What will you do to treat the constant 3.14 as a float?
A. use float(3.14f)
B. use 3.14f
C. use f(3.14)
D. use float(3.14f)

15.Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
A. rem = (5.5 % 1.3)
B. rem = modf(5.5, 1.3)
C. rem = fmod(5.5, 1.3)
D. rem = (5.5 % 1.3)

16.What will be the output of the program?
A. C++
B. C
C. Compiler error
D. C++

17.What will be the output of the program?
A. 2 in 16bit compiler, 4 in 32bit compiler
B. 4 in 16bit compiler, 2 in 32bit compiler
C. 4 in 16bit compiler, 4 in 32bit compiler
D. 2 in 16bit compiler, 4 in 32bit compiler

18.What will be the output of the program?
A. 0
B. 0.0
C. 7.0
D. 0

19.What will be the output of the program?
A. 6.0
B. 6
C. 6.000000
D. 6.0

20.What will be the output of the program?
A. 4, 4, 4
B. 4, 8, 8
C. 4, 8, 10
D. 4, 4, 4

21.What will be the output of the program?
A. 4.320000e+01, 43.200001, 43.2
B. 4.3, 43.22, 43.21
C. 4.3e, 43.20f, 43.00
D. 4.320000e+01, 43.200001, 43.2

22.What will be the output of the program?
A. C
B. C++
C. Compiler error
D. C

23.What will be the output of the program?
A. 2.000000, 1.000000
B. 1.500000, 1.500000
C. 1.550000, 2.000000
D. 2.000000, 1.000000

24.What will be the output of the program?
A. 2.2, 2.50, 2.50, 2.5
B. 2.2e, 2.25f, 2.00, 2.25
C. 2.250000e+000, 2.250000, 2.25, 2.250000
D. 2.2, 2.50, 2.50, 2.5

25.How many times "PAK-MCQS" is get printed?
A. Infinite times
B. 11 times
C. 0 times
D. Infinite times

26.How many times the while loop will get executed if a short int is 2 byte wide?
A. 254 times
B. 255 times
C. 256 times
D. 254 times

27.Which of the following is not logical operator?
A. &
B. &&
C. ||
D. &

28.In mathematics and computer programming, which is the correct order of mathematical operators ?
A. Addition, Subtraction, Multiplication, Division
B. Division, Multiplication, Addition, Subtraction
C. Multiplication, Addition, Division, Subtraction
D. Addition, Subtraction, Multiplication, Division

29.Which of the following cannot be checked in a switch-case statement?
A. Character
B. Integer
C. Float
D. Character

30.Point out the error, if any in the for loop.
A. There should be a condition in the for loop
B. The two semicolons should be dropped
C. The for loop should be replaced with while loop.
D. There should be a condition in the for loop


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