Thursday, December 7, 2017

TT TEST-1 (C-PROGRAMMING) RGAN FOR 3rd CSE

1)
main(){
printf("%d  %d   %d",sizeof(400L),sizeof(400)
,sizeof(400.0));
a)4 2 8     b)2  2 4      c)2 2 8     3)error

2)
char ch='xy';
val of ch is?
a)y         (b)x            c)none      d)NULL

3)
main()
{
int x;
x=10,20,30;
printf("%d",x);
}
a)30   b)20    c)10   d)error;
4)
main()
{
int a=117;
printf("%x",a);
}
a)75     b)117   c)error   d)0
5)
main(){
enum    bykes{suzuki,honda=3,hero};
printf("%d",suzuki+hero);
}
a)4       b)2       c)6     d)error
6)
Main()
{
int a=3,b=7,c;
c=a==b==1;
printf("%d",c);  
}
a)1           b)0        c)3      d)7
7)
#  define max (a,b)    a/b
Main() {
Printf(“\n%d”,max(10,3));
}
a)      3   b)3.333  c)3.333333  d)error


8) .what will be the output of the program?
#include<stdio.h>
int main()
{
    int k, num = 30;
    k = (num < 10) ? 100 : 200;
    printf("%d\n", num);
    return 0;
}
a)200    b)30    c)100     d)500

9).what are the invalid identifiers?
a.DOUBLE
b.Int
c.Float
d.all above


10) what will be the output of the program?
void  main()
{
int x;
x=015+0x71+5;
printf(“%d”,x);
}
a.13
b.131
c. compiler error
d.9

11). float f=10.3456F; int x=f;
 what was the value of x?
A.  10.3
B.  10
C.  10.345
D.  10.346

12)
int i=5;
int j;
j=++i + ++i + ++i;
printf("%d",j);
A.  21
B.  18
C.  24
D.  15

13).
int a=0,b=1;
if(a=0)
 { printf("\ntrue"); }
 else
 { printf("\nfalse"); }
A.  none
B.  true
C.  syntax error
D.  false
14)
printf(" %d %d %d",sizeof(3.14) , sizeof(3.14F), 
sizeof(3.14L));
A.  8 4 10
B.  4 4 4
C.  8 8 8
D.  4 4 10
9
15)which of the following are unary operators
 1. !     2. sizeof      3. ~        4. &&
A.  1,2
B.  1,3
C.  1,2,3
D.  2,4

16)char f=255; f++; printf("%d ",sizeof(f));
A.  2
B.  4
C.  compilation error
D.  1
17)
int a; a=sizeof(!5.6); printf("%d",a);
A.  2
B.  4
C.  10
D.  8
18)
void main()
{
            float x=10.2345F;
            int a;
            clrscr();
            a=x-(int)x;
            printf("\n%f",(float)a);
}
a)10.234500                b)0.000000                  c)error                         d)10.2345

19) 3.#include<stdio.h>
void main()
{
            int ch=NULL || EOF+1 && EOF ;
            clrscr();
            printf("%d",ch);
}
a)0       b)1       c)-1      d)48
20)
12. #include<stdio.h>
void main()
{
            int a=5^8;
            printf("%d",a*a);
}
a)13     b)169   c)-169  d)-13

Wednesday, December 6, 2017

TECHNICAL TEST-1(C LANGUAGE) FOR RGAN CSE CRT 1&2


RISE KRISHNA SAI GANDHI GROUP OF INSTITUTIONS::ONGOLE
DEPARTMENT OF CSE
TECHNICAL TEST-1(C LANGUAGE)
1. Which of the following is not a data type          
A. float   B. integer   C. long   D. char

2. What is ternary operator
A. ?;   B. +=   C. ?:   D. ?=

3. What is the output of this C code?                               
#include <stdio.h>
int main()
{
intvar=010;
printf("%d",var);
}
A. 2   B. 8   C. 9   D. 10

4. What is the value of x in this C code?                    
#include <stdio.h>
void main()
{
int x =5*9/3+9;
}
A. 3.75   B. Depends on compiler   C. 24   D. 3

5. What is the output of this C code?                       
#include <stdio.h>
void main()
{
int x =5.3%2;
printf("Value of x is %d", x);
}
A. Value of x is 2.3   B. Value of x is 1   C. Value of x is 0.3   D. Compile time error

6. c=++a – b will result in which of the following (if a=10, b=5)______   
      A. 5  B. 6C. 7 D. -6

7. What is the output of this C code?    
#include <stdio.h>
int main()
{
inti=-3;
int k =i%2;
printf("%d\n", k);
}
A. Compile time error   B. -1    C. 1   D. Implementation defined

8. What is the output for X=’A’-2;                     
A. 63B. 65C. 64D. 66

9. Which of the following shows the correct hierarchy of arithmetic operations in C   
A. / + * -   B. * - / +   C. + - / *D. * / + -

10. What will be the output of 5.0 / 2?   
A. 2   B. 3   C. 0   D. 2.5

11. Bitwise operators can operate upon?   
A. double and chars   B. floats and doubles   C. ints and floats   D. ints and chars

12. What is the work of break keyword?
A. Halt execution of program   B. Restart execution of program   C.  Exit from loop or switch statement   D. None of the avobe

13. Which of the following represents the end of the string   
A. \0 B. \pC. \nD. \1
14. What is the output for while(1) { }                   
A. 1B. 0C. compile errorD. infinite loop

15. Which of the following is the correct syntax for initialization of an array___  
A. n[3]={0 0 0 };B. n[3]={0,0,0};C. n[3]={0;0;0};D. n[3]=0;


16. ASCII
17. RAM
18. EEPROM
19. MSDOS
20. BIOS
21. URL
22.4GL
23. BCPL
24. AT&T
25. EBCDIC

26. Write the logic for printing digit in a word

27. Write the logic for greatest among two numbers using conditional expression

28. Write the logic for reverse number

29. Write the logic for even or odd number

30. Write the logic for factorial of a given number



Thursday, November 30, 2017

Program to return maximum link value if all link values are unique, other wise returns maximum repeated link value

/*   Program Long Coding : IMGIT Online Paper Dt :29-11-2017
program return max link value if all link values are unique other wise returns maximum repeated link value
10 20 30 40 50  it has to return 50
10 20 20 20 30 20it has to return 20
 */
# include <stdio.h>
# include <stdlib.h>
# include <conio.h>

struct link
{
int data;
struct link*next;
};

struct link*first=NULL;
struct link*last=NULL;

addlink(int dat)
{
struct link*newlink;

newlink=(struct link*)malloc(sizeof(struct link));
newlink->data=dat;
newlink->next=first;
first=newlink;

/* init last link */
last=newlink;

}

displaylinks()
{
struct link*current;
current=first;
while(current!=NULL)
{
printf("\n%d",current->data);
current=current->next;
}
}
int getmax()
{
    struct link*current;
    int max;
    current=first;
    max=current->data;
while(current!=NULL)
{
    if(current->data>max)
            max=current->data;
                current=current->next;
}

return max;
}

int findrptlink()
{
    struct link*current,*curr;
    int ctr=0,max=0,rptval;
current=first;
while(current!=NULL)
{
    ctr=0;
    curr=first;
        while(curr!=NULL)
        {
    //printf("\t%d",curr->data);
    if(current->data==curr->data)
            ctr++;
        curr=curr->next;
        }

    if(max<ctr)
        {
            max=ctr;
            rptval=current->data;
            //printf("\n%d..%d",ctr,current->data);
        }
        current=current->next;
}

if(max==1)
printf("\n%d",getmax());
else
    printf("\n%d",rptval);

}
/* program return max link value if all link values are unique other wise returns maximum repeated link value */


int main()
{
//clrscr();
puts("Linked list program");
addlink(10);
addlink(10);
addlink(130);
addlink(30);
addlink(30);
addlink(10);

    //displaylinks();

//displaylinks();
findrptlink();



}

















Saturday, November 25, 2017

Decimal to binary conversion using recursion function in C

/* decimal  to binary conversion using recursion */
#include<stdio.h>
#include<conio.h>
long binary(long  n){
static long int   bin=0,base=1;
if(n>0)
{
printf("%d",n%2);
bin=bin+n%2*base;
base*=10;
binary(n/2);
}
return bin;
}
main(){
long int n=100;
clrscr();
printf("\nbinary no is %ld",binary(n));
}

Tuesday, November 21, 2017

Practice for 3rd CSE RGAN dt 22-11-17

UNBOLD THE ANSWERS
1)
main(){
printf("%d  %d   %d",sizeof(400L),sizeof(400)
,sizeof(400.0));
a)4 2 8     b)2  2 4      c)2 2 8     3)error

2)
char ch='xy';
val of ch is?
a)y         (b)x            c)none      d)NULL
3)
main()
{ int a=5,b;
b=(a++,a++,++a,7*++a);
}     a value is?
a)35       b)42        c)57       d)error

4)
main()
{
int a;
a=sizeof(!-1.5);
printf("%d",a);
}
a)2    b)4    c)0   d)error
----------------------------------
# define no 5
# define noo no*no
main() {
printf("\n%d",noo);
}
a)error     b)25     c)55     d)5
-----------------------------------------
main()
{
int x;
x=10,20,30;
printf("%d",x);
}
a)30   b)20    c)10   d)error;

11)
main()
{
int a=117;
printf("%x",a);
}
a)75     b)117   c)error   d)0

6)
main(){
enum    bykes{suzuki,honda=3,hero};
printf("%d",suzuki+hero);
}
a)4       b)2       c)6     d)error
7)
Main()
{
int a=3,b=7,c;
c=a==b==1;
printf("%d",c); 
}
a)1           b)0        c)3      d)7


8)
main(){
int a=2;
if(a==2);
a=~a++*2;
printf("%d",a);
}
a)-8   b)-5   c)error   d)

9)
main()
{
int a=5,b=6;
if(a++ == b-- && --a==++b)
printf("true");
else
printf("\nfalse");
}
a)true     b) error      c) false    d)truefalse



Wednesday, November 8, 2017

Popup a dialog-box when loading a page using js

<!DOCTYPE html>
<html>
  <head>
    <meta charset=utf-8 />
    <title>ColorBox demo</title>
    <link rel="stylesheet" href="http://www.jacklmoore.com/colorbox/example1/colorbox.css" />
  </head>
  <body>
    <h1>Hello, there!</h1>
    <h2>This is some content</h2>
    <p>The popup will open in five seconds</p>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script src="http://www.jacklmoore.com/colorbox/jquery.colorbox.js"></script>
    <script>
      function openColorBox(){
        $.colorbox({iframe:true, width:"80%", height:"80%", href: "http://risegroup.edu.in/rise-20171104.JPG"});
      }
  //delay of 1 sec
      setTimeout(openColorBox, 1000);
    </script>
  </body>
</html>