prog_name one two three four will have the below behaviour ( select the right option ) A) program has compilation errors B) Program prints "three" C) program prints "hree" D) program prints "three four" 59) Which of the following statements are valid regarding "static" variables in C? A) Have global scope and lifetime till the end of the program. B) Have block scope and lifetime till the end of the block. C) Have block scope and lifetime till the end of the program. D) Have global scope and lifetime till the end of the block 60) What is the output of the code segment below? char c; int i = 0 ; for( c = 'A' + i ; c < 'Z' ; c += 2,i++ ) { printf("%c", c); } A) ADHMS (skips 2,3,4,5 characters in between A and Z) B) ACEGIKMOQSUWY (skips one char in between A and Z) C) ABCDEFGHI...Y (prints all characters from A to Y) D) Program does not compile. 61) Select the correct statements in relation to the "realloc" function A) The realloc tries to allocate new memory which starts at the old memory and if it cannot find sequential memory extending the old memory, realloc will fail... B) After the call to realloc, we need to copy the data from the old pointer C) Based on where the new memory is allocated, the realloc function takes care Of copying the data into the new location, but the caller needs to free the D) Both data copy and freeing of old memory whenever required, is taken care 62) In the declaration char c_arr[100] = "CMCLIMITED" ; , c_arr is : A) a constant pointer to character. B) non-const pointer to a character constant. C) non-const pointer to character. D) a constant pointer to constant character. 63) Looking at the code lines below, select the correct statement(s) below: Line 1 char *c_ptr; Line 2 char a_arr[100]; Line 3 c_ptr = (char *) malloc (10*sizeof (int)); Line 4 c_ptr = c_arr; Line 5 free (c_ptr); A) Line 3 has compilation error: it uses sizeof (int) instead of sizeof (char) B) Line 4 has an error as we cannot assign an array pointer to a normal pointer. C) Line 5 has a compilation error. D) Line 5 has undefined behavior. 64) Which of the following functions deal with binary output into a file? A) fprintf() B) fputs(); C) fwrite(); D) All of the above. 65) Which of the following are valid file operation functions in C? A) fseek() B) ftell() C) rewind() D) All of the above. 66) Assuming all headers included, indicate the behavior of the below program: Int arr[10] = {1,2,3,4,5,6,7,8,9,10}; Int I = 0; while( I < 10 ) { printf(“%d\n”, *(arr++)); } A) prints numbers from 1 to 10 B) prints numbers from 1 to 9 C) prints ‘1’ ten times. D) program has compilation errors. 67) Given a structure typedef struct { char x; int y, int z} mystruct; sizeof(mystruct) will return A) 5 -- Always B) 6 -- Some times C) 8 -- Based on Memory size D) None of the above 68) char *p = (char*) malloc(2000000*2/10+4); int length = strlen(p); Output of the above program: A) 400004 B) 200002 C) NULL D) None of the above 69) A program is written in “C” language , and an executable is made by compiling it on unix/linux environment. Can we run the executable on windows operating system. A) Yes, Always B) Only on vista operating system C) Never D) If we change extension to .exe, it will run 70) Main difference of a struct in C and C++ A) In C members are private, c++ members are virtual B) In C members are public, c++ members are private C) In C members are virtual, c++ members are private D) None of the above "/>

Latest CMC Aptitude Question SOLUTION: 42) Choose the valid typedef definitions from the following C code snippets A) typedef struct{...}T; B) typedef struct S{...}T; {...}T; D) typedef struct S{...}; 43) What are