Trace the error:

void main( )

{

int *b, &a;

*b = 20

printf(“%d, %d”, a, *b)

}

(A) No error (B) Logical error (C) Syntax error (D) Semantic error

1 Answer

Answer :

(C) Syntax error

Related questions

Description : What will be the output of the following segment of the program? main( ) { char *s = “hello world”; int i = 7; printf(“%, *s”, i, s); } (A) Syntax error (B) hello w (C) hello (D) o world

Last Answer : Answer: Marks given to all

Description : main() { Int a=3, b=2, c*d*e; d=&a; e=&b; c=*d+*e; } Which one of the given answers is correct? A) a=4, c-6 B) a=3, c=5 C) a=3, c=6 D) a=3, c=8

Last Answer : B) a=3, c=5

Description : What will be the output of the following ‘C’ code ? main ( ) { int x = 128; printf (“\n%d”, 1 + x++); } (A) 128 (B) 129 (C) 130 (D) 131

Last Answer :  (B) 129

Description : A three dimensional array in C' is declared as int A[x][y][z]. Here, the address of an item at the location A[p][q][r] can be computed as follows (where w is the word length of an integer): (A) &A[0][0][0]+w(y*z*q+z*p+r) (B) &A ... *q+r) (C) &A[0][0][0]+w(x*y*p+z*q+r) (D) &A[0][0][0]+w(x*y*q+z*p+r)

Last Answer : Answer: B

Description : What is the output of printf("%d")?

Last Answer : 1. When we write printf("%d",x); this means compiler will print the value of x. But as here, there is nothing after ï ½%dï ½ so compiler will show in output window garbage value. 2. When we ... an error without the proper number and type of arguments for things like printf(...) and scanf(...).

Description : What is the output of the following program ? (Assume that the appropriate pre-processor directives are included and there is no syntax error) main() { char S[ ] = "ABCDEFGH"; printf ("%C",* (& ... Base address of S is 1000 */ } (A) ABCDEFGH1000 (B) CDEFGH1000 (C) DDEFGHH1000 (D) DEFGH1000

Last Answer : (D) DEFGH1000

Description : Consider the following JAVA program: public class First { public static int CBSE (int x) { if (x < 100) x = CBSE (x +10); return (x - 1); } public static void main (String[] args){ System.out.print(First.CBSE(60)); } } What does this program print? (1) 59 (2) 95 (3) 69 (4) 99

Last Answer : (2) 95 

Description : A method name myMethod( ) that needs two integer arguments is declared as A) public void myMethod( ); B) public void myMethod(int a, int b); C) public void myMethod(int a, b); D) public int myMethod(a, b);

Last Answer : B) public void myMethod(int a, int

Description : The Servlet Response interface enables a servlet to formulate a response for a client using the method ............... (A) void log(Exception e, String s) (B) void destroy() (C) int getServerPort() (D) void setContextType(String Type)

Last Answer : (D) void setContextType(String Type)

Description : How many times the word 'print' shall be printed by the following program segment? for(i=1, i≤2, i++) for(j=1, j≤2, j++) for(k=1, k≤2, k++) printf("print/n") (A) 1 (B) 3 (C) 6 (D) 8

Last Answer : (D) 8

Description : Which of the following has compilation error in C ? (A) int n = 32; (B) char ch = 65; (C) float f= (float) 3.2; (D) none of the above

Last Answer : D

Description : Give output for following code: class student { int roll no; char name [14]; } s[6]; void main() { cout<<sizeof(s); }

Last Answer : Considering roll_no(Single variable) the output is: 96 OR Considering roll, no (Two variables) the output is: 108 OR Considering roll no the output is: error – space between roll and no

Description : Which of the following characteristics of constructor are true. i) They should be declared in the public section. ii) They are invoked automatically when the objects are created. iii) They do not have return type and void also. ... and v C) Only i, iii, iv and v D) All i, ii, iii, iv and v

Last Answer : D) All i, ii, iii, iv and v

Description : In C++, the keyword void was used ……….. A) To specify the return type of function when it is not returning any value. B) To indicate an empty argument list to a function. C) To declare the generic pointers. D) All of the above.

Last Answer : D) All of the above.

Description : Define a class student with int id and string name as data members and a method void SetData ( ). Accept and display the data for five students.

Last Answer : import java.io.*; class student { int id; String name; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); void SetData() { try { System.out.println("enter id and name for student"); ... (String are[]) {  student[] arr;  arr = new student[5];  int i;  for(i=0;i

Description : Why is the reward system so low compared to Q &A ? This means that the prizes of 2nd and 3rd are much less. When will the amount of prizes be increased more ?

Last Answer : answer:

Description : What is wrong in this statement? scanf(“%d”,whatnumber);

Last Answer : An ampersand & symbol must be placed before the variable name whatnumber. Placing & means whatever integer value is entered by the user is stored at the “address” of the variable name. This is a common mistake for programmers, often leading to logical errors.

Description : Write the output for the following commands: (i) ls –a (ii) date “+%D”

Last Answer : i) ls –a : list all files including hidden files. These are files that start with “.”. ii) date “+%D” : Display date as mm/dd/yy. output: 11/26/19

Description : What would happen if "String[]args" is not included as argument in the main method. A) No error B) Compilation error C) Program won't run D) Program exit

Last Answer : C) Program won't run

Description : How many times does the following code segment execute int x=1, y=10, z=1; do{y--; x++; y-=2; y=z; z++} while (y>1 && z

Last Answer : A) 1

Description : What will be the values of x, m and n after execution of the following statements? Int x, m, n; m=10; n=15; x= ++m + n++; A) x=25, m=10, n=15 B) x=27, m=10, n=15 C) x=26, m=11, n=16 D) x=27, m=11, n=16

Last Answer : C) x=26, m=11, n=16

Description : If m and n are int type variables, what will be the result of the expression m% n when m=5 and n=2 ? A) 0 B) 1 C) 2 D) None of the above

Last Answer : B) 1

Description : If an integer occupies 4 bytes and a character occupies 1 byte of memory, each element of the following structure would occupy how many bytes ? struct name { int age; char name[30]; }; A) 30 B) 32 C) 34 D) 36

Last Answer : C) 34

Description : Assume that variable x resides at memory location 1234, y at 1111 and p at 2222. Int x=1, y=2, *p; p=&x; y=*p; What will be the value of y after execution of above code? A) 2 B) 1 C) 1234 D) 1111

Last Answer : C) 1234

Description : int[ ] ={5,6,7,8,9} What is the value of a[3]? A) 9 B) 8 C) 7 D) 6

Last Answer : B) 8

Description : When the following code is executed what will be the value of x and y? int x = 1, y=0; y = x++; (A) 2, 1 (B) 2, 2 (C) 1, 1 (D) 1, 2

Last Answer : (A) 2, 1

Description : The correct way to round off a floating number x to an integer value is (A) y = (int)(x+0.5) (B) y = int(x+0.5) (C) y = (int)x+0.5 (D) y = (int)((int)x+0.5)

Last Answer : (A) y = (int)(x+0.5)

Description : What does the following declaration mean ? int (*ptr) [10]; (A) ptr is an array of pointers of 10 integers. (B) ptr is a pointer to an array of 10 integers. (C) ptr is an array of 10 integers. (D) none of the above.

Last Answer : (B) ptr is a pointer to an array of 10 integers.

Description : What is the value returned by the function f given below when n = 100 ? int f(int n)  { if (n==0) then return n;  else return n + f(n-2);  } (A) 2550 (B) 2556 (C) 5220 (D) 5520

Last Answer : (A) 2550

Description : Write a C program Reading and Writing data using Scanf() and Printf() statement -Technology

Last Answer : #include int main(){ char ch; char str[100]; printf('Enter any character '); scanf('%c', &ch); printf('Entered character is %c ', ch); printf('Enter any string ( upto 100 ... , str);}OUTPUT:Enter any characteraEntered character is aEnter any string ( upto 100 character )haiEntered string is hai

Description : printf ("%" d,% x ", & b); Explain the statement ?

Last Answer : printf ( % d,% x , & b); Here , the printf statement displays the output function printf () function as a variable data result of different data types. The C program is used to ... b respectively which indicates the memory location of integer type a and b variables where data will be stored.

Description : What kind of mistake is it to write print f instead of printf and why ?

Last Answer : Write print f instead of printf, the syntax is wrong. If the syntax is wrong then the language in which the program is written is grammatically incorrect. As can be seen , the word Printf ... error. This error is easily detected when translating with a compiler and sends a message to the computer.

Description : What are the functions of Printf () and Getch () function ?

Last Answer : The most commonly used function as an output statement in C language is printf (), which can be used to display various types of data (such as int, Char, float, etc.), including strings or strings ... programming . That is, both print () and getch () act as essential functions for C programming .

Description : printf() Function- What is the difference between "printf(...)" and "sprintf(...)"?

Last Answer : sprintf(...) writes data to the character array whereas printf(...) writes data to the standard output device.

Description : State the use of printf( ) & scanf( ) with suitable example.

Last Answer : printf( ) & scanf( ): printf() and scanf() functions are library functions in C programming language defined in stdio.h . printf() function is used to print the character, string, float, integer, octal and hexadecimal ... number"); scanf("%d",&i); printf("Entered number is: %d",i); getch(); }

Description : What error will be generated if a space is given between the logical AND operator (&&)? Will it be a compile-time or a run-time error?

Last Answer : Example: if(5>2 & & 6

Description : Match the following HTTP status code to their respective definitions. i) 400 a) OK ii) 500 b) Not found iii) 200 c) Continue iv) 100 d) Internal server error A) i-b, ii-d, iii-a, iv-c B) i-a, ii-b, iii-c, iv-d C) i-b, ii-c, iii-a, iv-d D) i-b, ii-a, iii-c, iv-d

Last Answer : A) i-b, ii-d, iii-a, iv-c

Description : Match the following mechanisms for interrupting the execution of a process and their uses. i) Interrupt a) Call to an operating system function ii) Trap b) Reaction to an asynchronous external event iii) Supervisor Call c) Handling of a error ... -a, iii-b C) i-b, ii-c, iii-a D) i-a, ii-c, iii-b

Last Answer : C) i-b, ii-c, iii-a

Description : Match the following HTTP status code to their respective definitions. i) 400 a) OK ii) 500 b) Not found iii) 200 c) Continue iv) 100 d) Internal server error A) i-b, ii-d, iii-a, iv-c B) i-a, ii-b, iii-c, iv-d C) i-b, ii-c, iii-a, iv-d D) i-b, ii-a, iii-c, iv-d

Last Answer : A) i-b, ii-d, iii-a, iv-c

Description : The ............layer of OSI model can use the trailer of the frame for error detection. A) Physical B) Data link C) Transport D) Presentation

Last Answer : A) Physical

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} a.setdefault(4,"D") print(a) a) {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’}. b) None. c) Error.

Last Answer : a) {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’}.

Description : What is the output of the following code? a={1:"A",2:"B",3:"C"} print(a.get(5,4)) a) Error, invalid syntax b) A c) 5 d) 4

Last Answer : d) 4

Description : Suppose d = { john :40, peter :45}, what happens when we try to retrieve a value using the expression d[ susan ]? a) Since susan is not a value in the set, Python raises a KeyError ... Python raises a KeyError exception d) Since susan is not a key in the set, Python raises a syntax error

Last Answer : c) Since “susan” is not a key in the set, Python raises a KeyError exception

Description : What will be the output? d1 = {"john":40, "peter":45} d2 = {"john":466, "peter":45} d1 > d2 a) True b) False c) Error d) None

Last Answer : c) Error

Description : What will be the output? d1 = {"john":40, "peter":45} Page No 40 d2 = {"john":466, "peter":45} d1 == d2 a) True b) False c) None d) Error

Last Answer : b) False

Description : What will be the output? d = {"john":40, "peter":45} "john" in d a) True b) False c) None d) Error

Last Answer : a) True

Description : What is the output of the following code? >>> a=(1,2,3,4) >>> del(a[2]) a) Now, a=(1,2,4) b) Now, a=(1,3,4) c) Now a=(3,4) d) Error as tuple is immutable

Last Answer : d) Error as tuple is immutable

Description : If a=(1,2,3,4), a[1:-1] is a) Error, tuple slicing doesn’t exist b) [2,3]. c) (2,3,4) d) (2,3)

Last Answer : d) (2,3)

Description : What will be the output? >>>my_tuple = (1, 2, 3, 4) >>>my_tuple.append( (5, 6, 7) ) >>>print len(my_tuple) a) 1 b) 2 c) 5 d) Error

Last Answer : c) 5