Breaking News

COMPUTER PROGRAMMING MCQs by General knowledge Solutions

COMPUTER PROGRAMMING MCQs  by General knowledge Solutions  

                                                                                 
                                                                                    











(1)    When executed this code fragment displays
 


(A)    a line of * with the shape of
 


(B)    a line of * with the shape of
 


(C)    line of * with the shape of

(D)    a line of * with the shape of
 


(E)    a triangle of * with the shape of


(2)    Which statement is a CORRECT C statement? (correct means that no error or warning is generated at the compilation)

(A)    char name[3] = “Kathryn”;
(B)    2x = 2.0;
(C)    double y[6] = {1.0,2.0};
(D)    char *x = ‘a’;
(E)    &x = 10;


(3)    Among the following, which one is NOT a valid C identifier?


(A)    concrete
(B)    brick
(C)    stone
(D)    struct
(E)    truss




(21-23) Consider the following program:
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
     FILE *file1, *file2;
     char letter;

     file1 = fopen(“chapter”, “r”);
     file2 = fopen(“book”, “w”);
     while(fscanf(file1, “%c”,&letter)!=EOF)
          fprintf(book, “%c”,letter);
     fclose(file1);
     fclose(file2);

     return EXIT_SUCCESS;
}

(4)    In the above program, chapter is

(A)    a variable of type double
(B)    a variable of type FILE
(C)    the name of a file known to the computer outside the C program
(D)    part of a message printed on the computer screen when the program is executed
(E)    a member of the FILE struct book

(5)    In the above program, EOF is?

(A)    a variable of type FILE
(B)    the value assigned to the variable letter by fscanf when reaching the end of the file read.
(C)    a counter to keep track of the number of characters read
(D)    A constant defined in the header file stdio.h which is used by some input/output functions (e.g. fscanf)
(E)    The name of a function that detects viruses when reading files

(6)    What is the result of the execution of the above program?

(A)    Assuming that the text file chapter exists, it is copied into the file book
(B)    Assuming that the text file book exists, it is copied into the file chapter
(C)    The program cannot execute since there is an error at the compilation
(D)    The variable pointed to by file1 is copied into the memory location of address file2
(E)    The variable pointed to by file2 is copied into the memory location of address file1



(24)Which of the following is FALSE regarding a recursive function?

(A)    A recursive function can always be rewritten with a loop
(B)    A recursive function always executes faster than its loop equivalent
(C)    A recursive function is a function that calls itself
(D)    Recursion can sometimes yield a natural and simple solution to a problem that would otherwise be very difficult to solve
(E)    When executing a recursive function, the computer transfers data to and from a memory area called the system stack.



(25) Consider the following truth table for the logical operation NAND

P
Q
P NAND Q
T
T
F
T
F
T
F
T
T
F
F
T

(25)Which of the following C conditional expressions would NOT reproduce the above truth table?


(A)    !(P&&Q)
(B)    !P || !Q
(C)    !(P&&Q) || !P || !Q
(D)    !(P&&Q) && (!P || !Q)
(E)     (P&&Q) && (!P || !Q)


26. The conditional compilation
a. It is taken care of by the compiler
b. It is setting the compiler option conditionally
c. It is compiling a program based on a condition
d. none of above

27. Originally ‘C’ was developed as:
a. System programming language
b. General purpose language
c. Data processing language
d. None of above

28. An inverted file
a. Locates information about data in small files that are maintained apart from actual data record
b. A file which stores opposite records
c. A file which stores information about records of a system
d. None of above


29. Which of the following is not a file operation:
a. Repositioning
b. Truncating
c. Appending
d. None of above

30. Latency time is:
a. Time taken by read/write head mechanism to position itself over appropriate cylinder
b. Time taken to transfer a dta from memory
c. Time taken by appropriate sector to come under read/write head
d. None of above

31. The two types of file structure existing in VSAM file are
a. Key sequenced structure, entry sequenced structure
b. Key sequence structure, exit sequenced structure
c. Entry sequence structure, exit sequenced structure
d. None of above

32. How many copies of a class static member are shared between objects of the class?
a. A copy of the static member is shared by all objects of a class
b. A copy is created only when at least one object is created from that class
c. A copy of the static member is created for each instntiation of the class
d. No memory is allocated for static members of a class

33. Which looping process checks the test condition at the end of the loop?
a. for
b. while
c. do-while
d. no looping process checks the test condition at the end

34. The default access level assigned to members of a class is ___________
a. Private
b. Public
c. Protected
d. Needs to be assigned

35. Which of the following correctly describes the meaning of‘namespace’ feature in C++?
a. Namespaces refer to the memory space allocated for names used in a program
b. Namespaces refer to space between the names in a program
c. Namespaces refer to packing structure of classes in a program.
d. Namespaces provide facilities for organizing the names in aprogram to avoid name clashes.

36. Which of the following correctly describes the meaning of ‘namespace’ feature in C++?
a. Namespaces refer to the memory space allocated for names used in a program
b. Namespaces refer to space between teh names in a program
c. Namespaces refer to space between the names in a program
d. namespaces provide facilities for organizing the names in a program to avoid name clashes

37. Which of the following language is not supported by C++?
a. Exception Handling
b. Reflection
c. Operator Overloading
d. Namespaces

38. class derived: public base1, public base2 { } is an example of
a. Polymorphic inheritance
b. Multilevel inheritance
c. Hierarchical inheritance
d. Multiple inheritance

39. Which of the following languages is a subset of C++ language?
a. C language
b. Java Language
c. C# language

d. language

No comments