C Language Online Test 4

What is the output? #include <stdio.h> void main() { int a[] = {10,12,6,7,2}; int i,sum=0; for(i=0; i<5; i++) { sum = sum + *(a+i); } printf(“%d\n”, sum); } Ans: Sum of array elements What is the output? int main() { int val = 5; int* ptr = &val; printf(“%d %d”,val,(*ptr)++); return 0; } Ans: 6 5 What is the output? void main() { int arr[ ] = {10,20,30,40,50,60,70}; int *i, *j; i = &arr[1]; j = &arr[5]; printf(“%u \n” , j – i ); printf(“%d \n” , *j – *i ); } Ans: 4 40 What is the output? int main(void) { int x = 5; int *p1, *p2; p1 = &x; p2 = p1; printf(“%u”,p2); return 0; } Ans: Address of [...]

Read more...

C Language Online Test 3

what is the output? int main() { int a[100]; int sum = 0; int k; for(k=0; k<100; k++) { *(a+k) = k; } printf(“%d”,a[–k]); return 0; } Ans: 99 What is the output? void main() { int i=5; int *p; p = &i; printf(”The value of i is : %d \n”,*p); *p = *p + 10; printf(”The value of i is : %d \n”, *p); } A: 5 15 What is the output? void main() { int a = 5; double b = 3.1415; void *vp; vp = &a; printf(“a=%d\n”, *((int *)vp)); vp=&b; printf(“b=%lf\n”,*((double *)vp)); } Ans: 5     3.1415 What is the output? int main () { int *p; p = NULL; printf(“ \n The value of p is %d \n” [...]

Read more...

C Language Practice Programs 2

What is the output? #include <stdio.h> void main() { int a[2][3]={0,1,2,3,4,5}; printf(“%d”,sizeof(a[2])); } Ans:  6 or 12 What will be the output of the following program code? #include <stdio.h> void main() { int i=3, *j, **k; j = &i; k = &j; printf(“%d%d%d”, *j, **k, *(*k)); } 444 000 333 433 Ans: 3 What is the output? #include <stdio.h> void main() { int a[]={1,2,3,4,5,6}; int* ptr = a + 2; printf(“%d”,*–ptr); } Ans: 2 Find the output of the following program. void main() { int array[10]; int *i = &array[2], *j = &array[5]; int diff = j-i; printf(“%d”, diff); } 3 6 Garbage value Error Ans: 3 What is the output? #include <stdio.h> void main() { int a[5]={1,3,6,7,0}; int* b; b = &a[2]; printf(“%d”,b[-1]); } Ans: 3 Attend Free Demo and Learn   [...]

Read more...

C Language Practice Programs 1

Determine output: #include <stdio.h> void main() { char *p = NULL; char *q = 0; if(p) printf(” p “); else printf(“nullp”); if(q) printf(“q”); else printf(” nullq”); } p q Depends on the compiler x nullq where x can be p or nullp depending on the value of NULL nullp nullq Ans: 4  What is the output? #include <stdio.h> void main() { printf(“Hi Friends”+3); } Output: Friends  The address operator &, cannot act on Constants Arithmetic expressions Both of the above Local variables Ans: 3 What is the output? #include <stdio.h> void main() { int a[][3]={0,1,2,3,4,5}; printf(“%d”,sizeof(a)); } Ans: 12 or 24 #include<stdio.h> void main() { int *ptr, a=10; ptr = &a; *ptr += 1; printf(“%d, %d”, *ptr, a); } 10, 10 10, 11 11, 10 11, 11 Ans: 4 Attend Free Demo and [...]

Read more...

PL SQL Practice Test 12

Where can a Varray be stored? At package or at the schema level. PL/SQL block or at the schema level. PL/SQL block or at the package level. PL/SQL block or package or at the schema level Ans : 4 Which of the following collections can be stored in the database? Associative array and Varray Varray and nested table Associative array and nested table Associative array, Varray and nested table Ans : 2 Which of the following collections have an initialized status as empty? Associative array Varray Nested table Records Ans : 1 What does DELETE (m,n) do [...]

Read more...

PL SQL Practice Test 11

What are the types of composite datatypes? Records and Nested table Collections and BOOLEAN Collections, PLS_INTEGER and BOOLEAN Collections and Records Ans : 4 Which of the following statement is true for a collection? In a collection, the internal components always have the same data type. In a collection, the internal components always have different data type In a collection, the internal components may have same data type or different datatype. All collection except records have the same datatype. Ans : 1 How are the elements of a collection variable accessed? variable_name[index] variable_name(index) index variable_name{index} Ans [...]

Read more...

PL SQL Practice Test 10

Which is not a type of trigger? DDL DML DCL Database Ans :  3 Which prefixes are available to Oracle triggers? : new only : old only Both: new and : old Neither: new nor :old Ans : 3  Triggers ________ enabled or disabled Can be  Cannot be Ought to be Always Ans : 1 What are the after triggers?  Triggers generated after a particular operation These triggers run after an insert, update or delete on a table These triggers run after an insert, views, update or delete on a table Both b and c Ans : 2 Which of the following is [...]

Read more...

PL SQL MCQ Questions 9

Which of the following is used to define code that is fired when certain actions or event occur? Replace Keyword Trigger Cursor Ans : 3  ………………….. are used to recreate if trigger already exists. Cursor Trigger Keywords Replace Ans : 4 For which trigger timing can you reference the NEW and OLD qualifiers? Statement and Row Statement only Row only Oracle Forms trigger Ans : 4 Which of the following is not a benefit of a database trigger? Enforcing referential integrity Event logging and storing information on table access Allowing invalid transactions Generating some derived column values automatically Ans : 3 Does the [...]

Read more...

PL SQL MCQ Questions 8

Which statement is package specification or body of a stored subprogram? Package Specification only requires recompilation Package body only requires recompilation Both package & body requires recompilation Both package & body does not require recompilation. Ans : 1 The packaged procedure that makes data in form permanent in the Database is Post Post form Commit form None of the above Ans :  3 Which of the following do not execute multiple PL/SQL programs simultaneously? Oracle Advanced Queuing DBMS_JOB DBMS_SQL Pipelined Functions Ans : 3 Which package can you use to output values and messages stored procedures? DBMS_DISPLAY DBMS_OUTPUT DBMS_LIST DBMS_DESCRIBE Ans : [...]

Read more...

PL SQL Practice Test 7

In a stored procedure, when specifying a string parameter should use which of these ? Char varchar2 TEXT REAL Ans : 2 A Stored Procedure is a Sequence of SQL or PL/SQL statements to perform specific function Stored in compiled form in the database Can be called from all client environments All of the above Ans : 4 Which of the following is true ,Creating a procedure have compile errors.? The line numbers reported match the line numbers you see in your text editor. SQL*Plus will automatically show the errors to you. To see [...]

Read more...