Padasalai net computer instructor trb exam study material c objective PDF

Title Padasalai net computer instructor trb exam study material c objective
Author Anonymous User
Course Engineering Mechanics
Institution Anna University
Pages 62
File Size 2.6 MB
File Type PDF
Total Downloads 10
Total Views 147

Summary

Download Padasalai net computer instructor trb exam study material c objective PDF


Description

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

1._______ is a collection of built -in functions that help us in our C program. ? A. Preprocessor file

B. Main file

C. header file

D. Ordinary file

Correct Answer : OPTION C, Header file is a collection of built -in functions that help us in our program. Header files contain definitions of functions and variables which can be incorporated into any C program by pre -processor #include statement. 2. Which of the following function reads a character only one at a time from terminal and return it as an integer? ? A. gets()

B. getchar()

C. scanf()

D. getc()

Correct Answer : OPTION B, getchar() function reads a character from the terminal and returns it as an integer. This function reads only single character at a time. You can use this method in the loop in case you want to read more than one characters.

3. Which of the following statement is true according to C syntax rule ? A. All C instruction must be written in Upper case character. B. C is not a case sensitive language. C. All C statement must end with a semicolon. D. All of the above. Correct Answer : OPTION C, All C statement must end with a semicolon is correct according to C syntax rule. Q. Which of the following is not a valid keyword in C language ? A. case

B. register

C. native

D. typedef

Correct Answer : OPTION C Q. The first character of an identifier in C langauge can contain ? A. only alphabet( a -z , A-Z ) or underscore ( _ )

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

B. only numeric character(0- 9) C. only special character($, #, @) D. all of the above Correct Answer : OPTION A Q. Which operator in C is used to return the size of a variable ? A. size operator

B. sizeof operator

C. & operator

D. ternary operator

Correct Answer : OPTION B Q. Which is the legal range of values for a int in C language ? A. 0 to 65535

B. -128 to 127

C. -32,768 to 32767

D. 0 to 255

Correct Answer : OPTION C Q. Which data type is used to store real numbers in C ? A. int

B. float

C. char

D. none of the above

Correct Answer : OPTION B Q. Point out the error in the following program ? #include int main() { void v = 0; printf("%d", v); return 0; } A. Error: Declaration syntax error

B. Program terminates abnormally

C. No error

D. None of these

Correct Answer : OPTION A Q. Which of the following is not logical operator?

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

A. &

B. &&

C. ||

D. !

Correct Answer : OPTION A Q. What will be the result of given code? main() { int i=3; switch(i) { default:printf ("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } } A. zero

B. three

C. error

D. none of the above

Correct Answer : OPTION B, The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match. Q. What will be the result of given code? main() { int i = 1; for(;;) { printf("%d",i++); if(i>5)

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

break; } } A. 1 2 3 4 5 B. error because condition in for loop is must C. error because of two semicolon inside for loop. D. error because of break inside for loop. Correct Answer : OPTION A Q. What will be the result of given code? main() { int i=1; int j=2; switch(i) { case 1: printf("one"); break; case j: printf("two"); break; } } A. one B. two C. error because constant expression require in place of j. D. none of the above. Correct Answer : OPTION C Q. What will be the result of given code? main() { printf(5+"Good Morning"); http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

} A. error

B. Good Morning

C. Morning

D. Good

Correct Answer : OPTION C, The statement printf(5+'Good Morning') skips 5 character of the followed string and then print string. Q. Can we use string inside switch statement? A. Yes

B. No

Correct Answer : OPTION B Q. What will be the result of given code? main() { int a =10; if(a=5) printf("hello"); else printf("bye"); } A. hello

B. hellobye

C. bye

D. error

Correct Answer : OPTION A, == must be used for comparison in the expression of if condition, if you use = the expression will always return true, because it performs assignment not comparison. In situations where we need to execute body of the loop before testing the condition, we should use ________ . A. for loop

B. while loop

C. do while loop

D. nested for loop

Correct Answer : OPTION C Q. What will be the result of given code? main() { http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here } A. error

B. 1

C. 10

D. none of the above

Correct Answer : OPTION B, Scanf returns number of items successfully read. Here, 10 is given as input which should have been scanned successfully. So number of items read is 1. Q. What will be the result of given code? main() { switch (2) { case 1: printf("one"); case 2: printf("two"); case 3: printf("three"); default: printf("four"); } } A. two

B. two three

C. two three four

D. error

Correct Answer : OPTION C, It isn't necessary to use break after each block, but if you do not use it, all the consecutive block of codes will get executed after the matching block. Q. What will be the result of given code? main() { int a = 0; if(a) printf("Study"); else printf("tonight"); }

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

A. error

B. study

C. tonight

D. none of the above

Correct Answer : OPTION C Q. What will be the output of the program if the array begins 1200 in memory ? main() { int arr[]={2, 3, 4, 1, 6}; printf("%u, %u, %u\n", arr, &arr[0], &arr); return 0; } A. 1200, 1202, 1204

B. 1200, 1200, 1200

C. 1200, 1204, 1208

D. 1200, 1202, 1200

Correct Answer : OPTION B, All the three - arr, &arr[0] and &arr represents the base address of the array. Q. Which of the following function is appropriate for reading in a multi -word string? A. printf()

B. scanf()

C. gets()

D. puts()

Correct Answer : OPTION C Q. Which of the following is not a valid declaraction of arrays? A. int marks[4]={ 67, 87, 56, 77 } B. float area[5]={ 23.4, 6.8, 5.5 } C. int marks[]={ 67, 87, 56, 77, 59 } D. int marks[4]={ 67, 87, 56, 77, 59 } Correct Answer : OPTION D Q. What will be the output of given code main() { char ch[20]; http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

ch = "Study Tonight"; printf("%s",ch); } A. error

B. Study Tonight

C. Study

D.Tonight

Correct Answer : OPTION A Q. What will be the output of given code? main() { int arr[3] = {1, 2}; printf("%d",&arr[2]); } A. error

B. garbage value

C. 1

D. 2

Correct Answer : OPTION B, After an array is declared it must be initialized. Otherwise, it will contain garbage value(any random value). Q. What will be the output of given code? main() { char str[7] = "strings"; printf("%s",str); } A. error

B. strings

C. cannot predict

D. none of the above

Correct Answer : OPTION C, cannot predict. This is because a string always end with NULL terminator i.e \0. Since, the size of the array is 7 and the string itself is of 7 characters, therefore there is no place for NULL termi nator. Therefore, we do not know where the string ends and ends up with garbage values. Q Which of the following function is used to show reverse of string? A. reverse()

B. strrev()

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

C. strreverse()

D. none of the above

Correct Answer : OPTION B Q. Which of the following represent null character in C? A. 0

B. /0

C. \0

D. none of the above

Correct Answer : OPTION C Q. which library file contain all the string handling functions? A. stdio.h

B. conio.h

C. string.h

D. none of the above

Correct Answer : OPTION C Q. What will be the output of given code? #include #include main() { int i; i = strcmp("study","tonight"); printf("%d",i); } A. error

B. -1

C. 0

D. 1

Correct Answer : OPTION B, strcmp () function will return the ASCII difference between first unmatching character of two strings.

Q. What error would the following function give on compilation? fun(int a,int b) { int a = 20; return a; } http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

A. no error B. The function should be defined as int fun(int a,int b) C. Redeclaration of variable a D. none of the above Correct Answer : OPTION C. Redeclaration of variable is not allowed. Q. In C language all function except main() can be recursive? A. Yes

B. No

Correct Answer : OPTION B Q. Which keyword is used to transfer control from a function back to the calling function? A. switch

B. break

C. goto

D. return

Correct Answer : OPTION D Q. Which of the following statements are correct about the function? int fun(int x) { int r=1; if(x==1) return 1; else r = x * fun(x -1); return r; } A. The function calculates the 2 raise to power of x. B. The function calculates the square root of x. C. The function return the cube of x. D. The function calculates factorial of x. Correct Answer : OPTION D Q. Functions cannot return more than one value at a time. True or False? A. True

B. False

Correct Answer : OPTION A

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

Q. Which of the following statement is true about a function with an argument? A. No value is pass to the function during function call. B. function with an argument must not have return type C. function with an argument is declared and define with parameter list D. none of the above Correct Answer : OPTION C Q A function can be defined inside another function. True or False? A. True

B. False

Correct Answer : OPTION A Q. Usually recursion works slower than loops. True or False? A. True

B. False

Correct Answer : OPTION A Q. A variable declared inside a function without any specification is by default? A. external variable

B. static variable

C. automatic variable

D. register variable

Correct Answer : OPTION C Q. ________ variable is initialized only once and remains into existence till the end of program? A. external

B. static

C. automatic

D. register

Correct Answer : OPTION B Q. Which keyword is used to define a new structure? A. struct

B. structure

C. typedef

D. none of the above

Correct Answer : OPTION A, struct keyword is used to define a structure. struct define a new data type which is a collection of different type of data. Q. Which of the following is not true about a structure? A. Structure are used to construct a complex data type in a meaningful way http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

B. We can also declare an array of Structure. C. A Structure can be nested inside under Structure. D. We cannot pass a structure as a function argument Correct Answer : OPTION D, We cannot pass a structure as a function argument is not a correct statement. We can pass a structure as a function argument in similar way as we pass any other variable or array. Q. _______ is a keyword used in C language to assign alternative names to existing types? A. struct

B. typedef

C. union

D. none of the above

Correct Answer : OPTION B Q. What will be the output of following code? main() { struct student { char name[20]; int roll; }; struct student s1 = { "adam", 101 }; struct student s2 = s1; printf("%s",s2.name); } A. Error: Invalid structure assignment

B. No output

C. adam

D. adam 101

Correct Answer : OPTION C Q. What will be the output of the program? #include struct course { int courseno; http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

char coursename[25]; }; int main() { struct course c[] = { {102, "C"}, {103, "C++"}, {104, "Java"} }; printf("%d ", c[1].courseno); printf("%s\n", (*(c+2)).coursename); return 0; } A. 102 C

B. 103 C++

C. 103 Java

D. 104 Java

Correct Answer : OPTION C Q. Point out the error in the code? struct Student { char[20] name; int rollno; struct Student s2; }; A. Error: in structure declaration

B. Linker Error

C. No Error

D. None of above

Correct Answer : OPTION A Q The . operator can be used access structure elements using a structure variable. True or False? A. True

B. False

Correct Answer : OPTION A Q. Size of a union is equal to _______? A. size of the largest element in the union

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

B. size of the smallest element in the union C. combination of all the element of union D. none of the above Correct Answer : OPTION A Q. What will be the output of following code? main() { union std { int x; int y; }; union std s1; s1.x =10; s1.y =20; printf("%d %d\n",s1.x, s1.y); return 0; } A. error

B. 20 20

C. only 20

D. none of the above

Correct Answer : OPTION B Q Is it necessary that the size of all elements in a union should be same? A. Yes

B. No

Correct Answer : OPTION B Q. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable? A. dot operator( . )

B. address operator( & )

C. indirection operator( * )

D. -> operator

Correct Answer : OPTION D, -> operator. http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

Q What will be the output of following code? #include main() { float a = 10.2; int *p = a; printf("%d",*p); } A. 10

B. 10.2

C. error: incompatible type

D. no output

Correct Answer : OPTION C, error: incompatible type . Q. The operator used to access the value of variable at address stored in a pointer variable is? A. indirection operator( * )

B. address operator( & )

C. dot operator( . )

D. logical And operator( && )

Correct Answer : OPTION A, indirection operator(*). Q. What will be the output of following code assuming that array begins at location 1002? #include main() { int a[5] = {1, 2, 3, 4, 5}; int *p = a; printf("%d\t%d\t%d\t%d\t",*p,0[a],a,p); } A. error

B. 1 1 1002 1002

C. 1 0 1002 0

D. 1 1 0 1002

Correct Answer : OPTION B, 1 1 1002 1002 Q. What will be the output of following code? #include int arr[]={1,2,3}; main() { http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

int *ptr; ptr = arr; ptr = ptr+3; printf("%d",*ptr); } A. error

B. 3

C. 2

D. garbage value

Correct Answer : OPTION D, ptr pointer is pointing to out of the array range of arr and thus, points to a garbage value. Q. What will be the output of following code? #include void main() { int const * p=5; printf("%d",++(*p)); } A. error

B. 5

C. 6

D. print address of p

Correct Answer : OPTION A, Cannot modify a constant value. p is a pointer to a constant integer. But we tried to change the value of the constant integer Q What will be the output of following code? #include main() { struct std { int x=3; char name[]="hello"; }; struct std *s; printf("%d",s->x);

http://www trbtnpsc com/2017/09/computer-instructor-trb-exam-study html

www.Padasalai.Net

www.TrbTnpsc.com

பி.எட் கணினி அறி฀ியல் பட்டதாரி மற் ற฀ம் ம฀த฀நிலல பட்டதாரி ஆசிரியர்கள் நல சங் கம் .REG. NO : 127/2016.

printf("%s",s->name); } A. 3 hello B. garbage value C. error in declaration of pointer to structure. D. error because of initializing variables in structure declarat ion Correct Answer : OPTION D, error because of initial...


Similar Free PDFs