Study Viral (Java Tutorials For Beginners - Step By Step)
  • Home
  • Java Tutorials
    • Core Java
    • Java Swing
    • MS Access JDBC Java Application
  • Facebook Page
  • Programs
    • C Programs
    • C++ Programs
    • Java Programs
    • Python Programs
  • UGC NET
  • Home
  • Java Tutorials
    • Core Java
    • Java Swing
    • MS Access JDBC Java Application
  • Facebook
  • Programs
    • C Programs
    • C++ Programs
    • Java Programs
    • Python Programs
  • UGC NET

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 8)

 July 13, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 8)

Q8. A graphic display system has a frame buffer that is 640 pixels wide, 480 pixels high and 1-bit of color depth. If the access time for each pixel on the average is 200 nanoseconds, then the refresh rate of the frame buffer is approximately :

(1) 16 frames per second                                                  (2) 19 frames per second
(3) 21 frames per second                                                  (4) 23 frames per second

 Answer: (1) 16 frames per second    

Reason : Here 640 pixel wide is width of screen means vertical line on screen and 480 pixels high is means vertical line on screen.
Now                                 width (w) = 640 px             and                   height (h) = 480 px
                                        Total = 640 x 480 = 307200

                                        Color depth = 1-bit/px
                                        Memory required for total pixel = w x h x Color Depth
                                        Memory required for total pixel = 640 x 480 x 1-bit = 307200

                                       1 pixel takes 200 nano second to refresh
                                       To refresh the whole screen = 640 x 480 x 200 ns = 61440000 nano second
                                     
                                       For 1 nano second =   ____1____  screen
                                                                            61440000
                                                                                                                                                        9
                                      Now Convert nano seconds to second we multiply above value with 10
                                                                                                     9
                                      For 1 nano second =   ____1____  x 10  = 16.2760 = 16 (Approximately)
                                                                            61440000

                                      The above solved values is closed to Option (1).



                                                                                                                             
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 7)

 July 13, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 7-9)

Q7. Which of the following statement is/are true ?

P: C programming language has a weak type system with static types.
Q: Java programming language has a strong type system with static types.

Code :
(1).  P only                                    (2).  Q only
(3).  Both P and Q only                 (4).  Neither P nor Q

Answer : (3).  Both P and Q only

Reason: Now in this question first of all we should have the knowledge or idea about words
dynamic/static types which means that the type information acquired at run time or compile time.
The static types checked at compile time and dynamic types checked at run time.

Secondly we also need information about weak/strong types means weather language tries to do implicit conversion from one type to another type.
The strong types means No implicit conversion and weak types means implicit conversion is allowed.

What makes a type system weak or strong comes down to a the ways in which the programmer is able to create type errors.

Now the C language is consider as weak typed because a programmer is allowed to cast types. I can add a pointer to a character if I just tell C that they are both integers.
 
           int main () {
             char ch = 'b';
             void *x;
             (int)ch + (int)x;
          }
 
Java has static type casting as well which allows the programmer to, for example, downcast objects. This makes the static type system not sound. But Java has dynamic type checking for just this reason. Yes, Java has dynamic and static type checking. For this reason, however, I think many people would consider Java to be strongly typed.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) Question 5-6

 July 13, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) Question 5-6



Q5. Given below are three implementations of the swap() function in C++.


(a)(b)(c)
void swap (int a,int b)
{
       int temp;
       temp = a;
       a = b;
       b = temp;
}
int main()
{
       int p = 0, q =1;
       swap(p,q);
}
void swap (int &a,int &b)
{
       int temp;
       temp = a;
       a = b;
       b = temp;
}
int main()
{
       int p = 0, q =1;
       swap(p,q);
}
void swap (int *a,int *b)
{
       int *temp;
       temp = a;
       a = b;
       b = temp;
}
int main()
{
       int p = 0, q =1;
       swap(&p,&q);
}


Which of the following actually swap the contents of the two integer variables p and q ?  

(1). (a) only                    (2).  (b) only               (3).  (c) only                  (4). (b) and  (c) only

 Answer : (2). (b) only

Reason : If we execute option (a) code than that code will only pass the value of p and q to the function swap (i.e. called pass by value) which will not exchange the values of p and q also there is no use of address operator.

If we execute option (b) code than that code will pass address locations of p and q to swap function instead of actual values. Now the temp stores the value of a (i.e. address location of p, e.g. 1000) when temp = a; after that we have a=b; which replaces the value of a with new value of b i.e. address of q, e.g. 1002 and b=temp; again replaces the actual value of b with value temp (i.e. address location of p). When the swap function finishes its execution part with exchange the content of variable p and q because it replaces the address locations.

If we try to execute option (c) than the code will work fine but it will not replace the content of p and q. Here inside the swap function there is only exchange of addresses for pointer variable a and b not for p and q, So there is exchange of contents for p and q.


Q6. In Java which of the following statement is/are true ?

S1 : The 'final' keyword applied to a class definition prevents the class from being extended through derivation.

S2 : A class can only inherit one class but can implement multiple interfaces.

S3 : Java permits a class to replace the implementation of a method that it has inherited. It is called method overloading.

Code :
(1).  S1 and S2 only                                                (2).  S1 and S3 only
(3).  S2 and S3 only                                                (4).  All of S1,S2 and S3

Answer :  (1).  S1 and S2 only        

Reason : The statement S1 is true, we can not extends a class which having final keyword with class declaration.
The Second statement S2 is also true that Java don't allow us to extend multiple classes at one time but Java allows us to implement multiple interfaces by using implements keyword.

The third statement S3 is false because the ability of a subclass to override a method allows a class to inherit from a superclass and it is called overriding. The overriding method has the same name, number and type of parameters, and return type as the method that it overrides. An overriding method can also return a subtype of the type returned by the overridden method.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 3-4)

 July 08, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 3-4)


Q3. What is the output of the following JAVA program ?

      
       class simple
       {
           public static void main(String []args)
           {
                simple obj = new simple();
                obj.start();
           }
           void start()
           {
                 long [] P ={3,4,5};
                 long []Q = method(P);
                 System.out.print(P[0]+P[1]+P[2]+" : "); 
                 System.out.print(Q[0]+Q[1]+Q[2]+" : ");
           } 
           long [] method(long []R)
           {
                 R[1] = 7;
                 return R;
           }
       }//end of class

    (1) 12:15
    (2) 15:12
    (3) 12:12
    (4) 15:15

Reason : Initially array P as {3,4,5}. When we pass array P to method as method(P); the method function replaces the value of index 1  i.e. 4 with 7. Now new updated array is value {3,7,5}.
This new returned value reflects on both arrays respectively P and Q. Last the print function adds all index location values of  both arrays separately and shows output 15:15.  


Q4. What is the output of following 'C' program? (Assuming little - endian representation of multi-byte data in which Least Significant Byte (LSB) is stored at the lowest memory address.)

1. #include <stdio.h>
2. #include <stdlib.h>/**/
3. int main()
4. {
5.     union saving
6.     {
7.         short int one;
8.         char two[2];
9.     };
10.    union saving m;
11.    m.two[0] = 5;
12.    m.two[1] = 2;
13.    printf("%d, %d, %d\n",m.two[0],m.two[1],m.one);
14.    return 0;
15. }

(1)   5 ,2, 1282
(2)   5 ,2, 52
(3)   5 ,2, 25
(4)   5 ,2, 517 

 Reason : This is one is interesting question in exam. First we have to know about Big-endian and little-endian are terms that describe the order in which a sequence of bytes are stored in computer memory. Big-endian is an order in which the "big end" (most significant value in the sequence) is stored first (at the lowest storage address). Little-endian is an order in which the "little end" (least significant value in the sequence) is stored first. For example, in a big-endian computer, the two bytes required for the hexadecimal number 4E52 would be stored as 4E52 in storage (if 4E is stored at storage address 1000, for example, 52 will be at address 1001). In a little-endian system, it would be stored as 524E (52 at address 1000, 4E at 1001).
Here we have little - endian in our question. In code we have two union members short int one and char two[2]. In line 11,12 we have numeric values 5 and 2 in char array (without single quote '5' and '2'). In line 13 the output also shows result with %d (i.e. represents for numeric values) which is okay for output 5, 2 but how third values came because we did not provided any value to union member short int one. Just suppose binary conversion of
    5 is 00000101 and  2 is 00000010

Lowest Address (1000)Highest Address(1001)
0000010100000010

Now as per question requirement little - endian representation of multi-byte data in which Least Significant Byte (LSB) is stored at the lowest memory address. Therefore

Lowest Address (1000)Highest Address(1001)
0000001000000101
Now 00000010-00000101 convert this to Decimal value

512+0+0+0+0+0+0+4+0+1  = 517 
After converting the combination of both numbers we have 517 at third location and final result 5, 2, 517.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 1-2)

 July 08, 2018     Computer Science And Applications Paper-II, UGC NET JULY 2018     No comments   

UGC NET JULY 2018 (Computer Science And Applications Paper-II)
(Question 1-2)

Q1. The definition in an XML document are said to be _____________ when the tagging system and definitions in the DTD are all in compliance.

(1) well-formed
(2) reasonable
(3) valid
(4) logical

Answer : (3)  

Reason : XML Document Type Declaration, commonly known as DTD.
An XML document can be defined as:

  • Well-formed: If the XML document adheres to all the general XML rules such as tags must be properly nested, opening and closing tags must be balanced, and empty tags must end with '/>', then it is called as well-formed.
    OR
  • Valid: An XML document said to be valid when it is not only well-formed, but it also conforms to available DTD that specifies which tags it uses, what attributes those tags can contain, and which tags can occur inside other tags, among other properties.

Q2. Consider the JavaScript Code:

      var y = "12";
      function f(){
           var y ="6";    
           alert(this.y);
           function g(){alert(y);}
           g();
      }
           f(); 


      If  M is the number of alert dialog boxes generated by this JavaScript code and Dl, D2, ...., DM 
        represents the content displayed in each of the M dialog boxes, then :

     (1)   M3; Dl displays "12"; D2 displays "6"; D3 displays "12".
     (2)   M-3; Dl displays "6"; D2 displays "12"; D3 displays "6".
     (3)   M:2; D! displays "6"; D2 displays "12".
     (4)   M:2; Dl displays "12"; D2 displays "6". 

 Answer : (4) 
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Java Program 31 - Java Program to Number Patterns - Study Viral

 June 26, 2018     Java Programs, Java Tutorials     No comments   

Java Program 31 - Java Program to Number Patterns - Study Viral

Program No 31
In This Video You Can See how to Make Following
Kind of Number Pattern...

                  1
                1 2 1
              1 2 3 2 1
            1 2 3 4 3 2 1
          1 2 3 4 5 4 3 2 1
        1 2 3 4 5 6 5 4 3 2 1
      1 2 3 4 5 6 7 6 5 4 3 2 1
    1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
  1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1  


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Java Program 30 - Java Program to Number Patterns - Study Viral

 June 26, 2018     Java Programs, Java Tutorials     No comments   

Java Program 30 - Java Program to Number Patterns - Study Viral

Program No 30
In This Video You Can See how to Make Following
Kind of Number Pattern...

         1
        1 2
       1 2 3
      1 2 3 4
     1 2 3 4 5
    1 2 3 4 5 6
   1 2 3 4 5 6 7     
 
 



Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Java Program 29 - Java Program to Number Pattrens - Study Viral

 June 26, 2018     Java Programs     No comments   

Java Program 29 - Java Program to Number Patterns - Study Viral 

 Program No 29
In This Video You Can See how to Make Following
Kind of Pattern...


    
         1
        2 2
       3 3 3
      4 4 4 4
     5 5 5 5 5
    6 6 6 6 6 6
   7 7 7 7 7 7 7     


.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Java Servlet JSP - Logout with Back Button Solution - StudyViral (Part-3)

 June 10, 2018     Java and J2EE web applications, Java MySQL, Java Servlets, Servlet, Servlet Tutorial     No comments   

Java Servlet JSP - Logout with Back Button Solution - StudyViral (Part-3)

Hello Viewers
Welcome to STUDYVIRAL Channel

In Previous videos you had learned How to write login code using JSP & Servlets after Clicking on activation link.

In Current video i am going to show you how to remove session and with back button solution so after logout user can't go back to previous page.

This video is continuation of Previous video.

DataBase :: MySQL

Required Jar Files For This Project (You Can Google for Download)

-- servlet-api-4.0.jar
-- java-mail-api.jar
-- activation.jar
-- commons-codec-1.7.jar (For Generate Encrypt Text)
-- mysql-connector-java-5.1.9.jar

The Above Jar Files are already Added to My Project.

In This Project I Am Using Servlet Annotations(So No web.xml file needed)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Java Servlet JSP Login with MySQL Database - StudyViral

 June 05, 2018     Java and J2EE web applications, Java MySQL, Java Servlets, Servlet, Servlet Tutorial     No comments   

Java Servlet JSP Login with MySQL Database - StudyViral


This video you will Learn How to write login code using JSP & Servlets after Clicking on activation link. Also you will learn about HttpSession for validation.

This Login application uses the "JavaBeans" and "DAOs".

This video code also prevent access to specific pages to the users who are not logged in i.e. show or display pages to only logged in users, if user is not logged in then show user login page or redirect the user to login page.

This video is continuation of Previous video.

DataBase :: MySQL

Required Jar Files For This Project (You Can Google for Download)

-- servlet-api-4.0.jar
-- java-mail-api.jar
-- activation.jar
-- commons-codec-1.7.jar (For Generate Encrypt Text)
-- mysql-connector-java-5.1.9.jar

The Above Jar Files are already Added to My Project.

In This Project I Am Using Servlet Annotations(So No web.xml file needed)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Facebook

StudyViral

Labels

Alphabet Pattern Binary Tree BLOB (Binary Large Object) Computer Networks Computer Science And Applications Paper-II Data Structure DBMS Digital Clock Digital Watch Extra Tutorials File Upload Find Age from Date of Birth Graph-Algorithms Java and J2EE web applications JAVA JDK 12 Java Mail API Java MySQL Java Programs Java Programs List Java Servlets Java Swing Java Swing With MySQL Database Java Tutorials JCalender KVS Compuer Science - January 2017 Question Paper MS Access JDBC Java Application Multiuser Login NETBEANS 11 IDE Occurrence of Digits in Number Operation System Pattern Program Reverse of String Sending Email Servlet Servlet Tutorial Software Engineering Star Struts 2 FrameWork Struts 2 Registration Form UGC NET JULY 2018 Windows Commands

Popular Posts

  • Install NetBeans 11 IDE on Windows 10 - Study Viral
    Install NetBeans 11 IDE on Windows 10 - Study Viral How to Install NetBeans 11 IDE on Windows 10. Download Link : https://netbeans...
  • UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 51-53)
    UGC NET JULY 2018 (Computer Science And Applications Paper-II) (Question 51-55) Q 51. At a particular time of computation, the value ...
  • Program 01: Write a program to display/print your name.
     Program 01 - Write a program to display/print your name. This is a very basic and introductory program in Java. You might see similar p...

Categories

  • Alphabet Pattern (13)
  • Binary Tree (2)
  • BLOB (Binary Large Object) (1)
  • Computer Networks (2)
  • Computer Science And Applications Paper-II (40)
  • Data Structure (6)
  • DBMS (1)
  • Digital Clock (1)
  • Digital Watch (1)
  • Extra Tutorials (3)
  • File Upload (1)
  • Find Age from Date of Birth (1)
  • Graph-Algorithms (1)
  • Java and J2EE web applications (3)
  • JAVA JDK 12 (1)
  • Java Mail API (3)
  • Java MySQL (5)
  • Java Programs (44)
  • Java Programs List (3)
  • Java Servlets (3)
  • Java Swing (16)
  • Java Swing With MySQL Database (4)
  • Java Tutorials (37)
  • JCalender (1)
  • KVS Compuer Science - January 2017 Question Paper (6)
  • MS Access JDBC Java Application (6)
  • Multiuser Login (1)
  • NETBEANS 11 IDE (1)
  • Occurrence of Digits in Number (1)
  • Operation System (4)
  • Pattern Program (8)
  • Reverse of String (2)
  • Sending Email (1)
  • Servlet (3)
  • Servlet Tutorial (3)
  • Software Engineering (4)
  • Star (7)
  • Struts 2 FrameWork (2)
  • Struts 2 Registration Form (1)
  • UGC NET JULY 2018 (40)
  • Windows Commands (2)

Pages

  • Java Tutorials
  • ASP.NET (in Hindi)
  • Java Programs List

Blog Archive

  • ▼  2021 (3)
    • ▼  April 2021 (3)
      • Program 03: Write a program to show the use of Dat...
      • Program02: Write a program to Add Two Integers.
      • Program 01: Write a program to display/print your ...
  • ►  2019 (7)
    • ►  June 2019 (1)
    • ►  May 2019 (2)
    • ►  March 2019 (4)
  • ►  2018 (111)
    • ►  November 2018 (7)
    • ►  October 2018 (20)
    • ►  September 2018 (10)
    • ►  August 2018 (3)
    • ►  July 2018 (19)
    • ►  June 2018 (5)
    • ►  May 2018 (2)
    • ►  April 2018 (3)
    • ►  March 2018 (11)
    • ►  February 2018 (18)
    • ►  January 2018 (13)
  • ►  2017 (36)
    • ►  December 2017 (10)
    • ►  November 2017 (9)
    • ►  October 2017 (7)
    • ►  September 2017 (10)

About Me

Rohit Basra
Hello guys my name Rohit Basra. I love to code and teach java language.
View my complete profile

Followers

Copyright © Study Viral (Java Tutorials For Beginners - Step By Step) | Powered by Blogger