PREVIOUS QUESTIONS: SET-4

SET-1         SET-2       SET-3      SET-4       Coding  MCQs


1.main(int argc,char*argv[])
   in the above Definition of main function the variable argv denotes:
a. An array of character pointers the first array item pointing to the program name     and remaining pointing to the command line parameters
b. An array of character pointer each pointing to the command line parameters
c. A pointer to character that points to command line parameters
d. A pointer to pointer that points to the memory location where the program has        been loaded to the memory

Ans: a

2.#include <stdio.h>
int main()
{
int n,ch,
for(n=7;n!=0;n--)
printf(“n=%d”,n--)
ch=getchar();
return 0;
}

a)Infinite loop
b)Numbers 7 to 0 in descending order
c)None of the other choices as there is a compilation error
d)Numbers 7 to 1 in descending order.

Ans: a

3.easha works for ISRO where she is involved in a mission to intercept a comet      that is likely to collide with in each with in 1 month.she is developing a c program  to calculate the trajectory of the missile to be launched to intercept and destroying the approaching comet.in order to achieve highest accuracy of the missile trajectory what data type should she use for the variables in her equation??

a. long int
b. double
c. float
d. int

Ans: double

4.a program reads in 500 integers in the range [0...100]representing the scores of 500 students.it then prints the frequency of each score above 50.what would be the best way for the program to store the frequencies?

a. An array of 101 numbers
b. An array of 50 numbers
c. An array of 500 numbers
d. A dynamically allocated array of 550 numbers

Ans: b

5. Which of the following is TRUE about binary trees?
    The number of nodes on the last level is equal to the sum of the number of             nodes on all other levels

a. A node may have one child
b. The total number of nodes is one less than a power of 2
c. Every node must have 2 children

Ans : a

6. #include <studio . h> 
   long int fact (int n);

   int main ()
{
 int n;
printf (“enter a positive integer: “);
scanf (“%d”, &n);
printf(“factorial of %d = %ld “, n, fact (n));
return 0;
}
long int fact (int n)
{
if (n.=1)
return n*fact (n-1)
else
return 1;
}

The above program uses which of the following 
a) Looping

b) Array

c) Recrusion

d) Linked List

Ans: c

Coding Question:
Print the nth term of a fibonacci sequence which starts with 1 2. i.e find the nth term of the sequence
1 2 3 5 8 13 21......

No comments:

Post a Comment

CTS Written test results of Vijayawada, Guntur, Ongole, Godarvari Districts were out.  Tentative dates of TR and HR are 24th and 25th Nov...