1.. Observe following function declaration and choose the best answer:
int divide ( int a, int b = 2 )
a. Variable b is of integer type and will always have value 2
b. Variable a and b are of int type and the initial value of both variables is 2
c. Variable b is international scope and will have value 2
d. Variable b will have value 2 if not specified when calling function
Ans:-d
2 What will be the result of the following program ?
Void main()
{
Int a=8,b=2,c,*p;
C=(a=a+b,b=a/b,a=a*b,b=a-b);
P=&c;
Clrscr();
Printf(“n%d”,++*p);
}
a.
b.
c.
d.

50
46
36
40

Answer is:b

Q3 Which of the following gives the memory address of the first element in array foo, an
array with 100 elements?
A. foo[0];
B. foo;
For more Questions Visit www.csemcq.com
C. &foo;
D. foo[1];
Ans b
Q4 Which of the following correctly initializes an array arr to contain four elements each with
value 0?
I int [] arr = {0, 0, 0, 0};
II int [] arr = new int [4];
III int [] arr = new int [4];
for (int i = 0; i < arr. length; i ++)
arr [i] = 0;
A.I only
B.I and III only
C.II and III only
D.I, II, and III
ANSWER:D

Q5 Given a pointer to a structure containing a calendar date, which of the following statements
correctly references the day of the week?
a. *date.day
d. ptr->date.day
b. *(date.day)
e. ptr->date->day
c. ptr->day
ANSWER: D
Q6.What is ASCII values of EOF in text files?
a) 25
b) 28
c) 26
d) 22
ans.c

For more Questions Visit www.csemcq.com
Q7 Consider the declaration
int a=5, *b=&a;
The statement
Printf(“%d”, a * b);
Prints
a. 25
b. Garbage
c. 5* address of b
d. An error message
Answer is : d
Q8 Which of the following is false about functions ?

a.
b.
c.
d.

More that one function allowed in a program
A function can call itself
Constants can appear in the formal argument list
A function can call another function

Ans:-c
Q9) Which statement is correct for binary files?
a) its character are readable.
b) it saves a lot of disk space
c) both
d) none of these
ans.b
Q10 Evaluate !(1 && !(0 || 1))
a.
b.
c.
d.

True
False
Unevaluated table
None of the above
Ans:a

For more Questions Visit www.csemcq.com
For more Questions Visit www.csemcq.com

C mcq practice test 4

  • 1.
    1.. Observe followingfunction declaration and choose the best answer: int divide ( int a, int b = 2 ) a. Variable b is of integer type and will always have value 2 b. Variable a and b are of int type and the initial value of both variables is 2 c. Variable b is international scope and will have value 2 d. Variable b will have value 2 if not specified when calling function Ans:-d 2 What will be the result of the following program ? Void main() { Int a=8,b=2,c,*p; C=(a=a+b,b=a/b,a=a*b,b=a-b); P=&c; Clrscr(); Printf(“n%d”,++*p); } a. b. c. d. 50 46 36 40 Answer is:b Q3 Which of the following gives the memory address of the first element in array foo, an array with 100 elements? A. foo[0]; B. foo; For more Questions Visit www.csemcq.com
  • 2.
    C. &foo; D. foo[1]; Ansb Q4 Which of the following correctly initializes an array arr to contain four elements each with value 0? I int [] arr = {0, 0, 0, 0}; II int [] arr = new int [4]; III int [] arr = new int [4]; for (int i = 0; i < arr. length; i ++) arr [i] = 0; A.I only B.I and III only C.II and III only D.I, II, and III ANSWER:D Q5 Given a pointer to a structure containing a calendar date, which of the following statements correctly references the day of the week? a. *date.day d. ptr->date.day b. *(date.day) e. ptr->date->day c. ptr->day ANSWER: D Q6.What is ASCII values of EOF in text files? a) 25 b) 28 c) 26 d) 22 ans.c For more Questions Visit www.csemcq.com
  • 3.
    Q7 Consider thedeclaration int a=5, *b=&a; The statement Printf(“%d”, a * b); Prints a. 25 b. Garbage c. 5* address of b d. An error message Answer is : d Q8 Which of the following is false about functions ? a. b. c. d. More that one function allowed in a program A function can call itself Constants can appear in the formal argument list A function can call another function Ans:-c Q9) Which statement is correct for binary files? a) its character are readable. b) it saves a lot of disk space c) both d) none of these ans.b Q10 Evaluate !(1 && !(0 || 1)) a. b. c. d. True False Unevaluated table None of the above Ans:a For more Questions Visit www.csemcq.com
  • 4.
    For more QuestionsVisit www.csemcq.com